API
This page documents the HTTP endpoints for SA.
The API requires Station Alert, and does not work for Sonoran Edition. For more info, see here.
How to Use
The endpoints documented below are made available directly from the resource.
To access the API, you first need to know the IP address or domain, and port of the server.
With this information, you can append /inferno-station-alert/
and then the endpoint name.
For example, if your domain is my-server.com
, the port is 30120
, and you wanted the alert
endpoint, you would access http://my-server.com:30120/inferno-station-alert/alert
.
Every request requires an Authorization
header containing the ic_sa_access_token
. If ic_sa_access_token
is not set, then a 404 - Not Found will be returned, and an error will be logged to the console. If ic_sa_access_token
does not match the token provided in the Authorization
header, then a 401 - Unauthorized will be returned.
If ic_sa_whitelisted_ips
contains any valid IP addresses, then any requests sent from IP address not contained within ic_sa_whitelisted_ips
will be rejected with 401 - Unauthorized, and an error will be logged to the console.
Valid HTTP requests are logged to the console when Debug Mode is enabled.
Alerts
Create A New Alert
Use this endpoint to create a new Alert.
Endpoint
POST alert
Body
locations
-object
- Must be an object that contains the names of locations, and optionally a list of door names to open.
- To open all doors, pass an empty array.
- To not open any doors, pass an array with a single empty string.
- Example:
{
"locations": {
"Station One": ["Bay Two", "Bay Three"],
"Station Two": [],
"Station Three": ["Bay One", "Bay Two"]
}
}
- Must be an object that contains the names of locations, and optionally a list of door names to open.
message
-string|undefined
- Optional message to be read out via Text-to-Speech.
- Requires Voice Turnout Addon, see here for details.
- Optional message to be read out via Text-to-Speech.
tone
-string|undefined
- Optional tone to play.
- If not provided, default tone will be used.
tones
-object
- Optionally provide a specific tone for each location.
- If provided,
tone
is ignored. - Example:
"tones": {
"Station One": "Tone 1",
"Station Two": "Tone 2"
}
unitcolors
-string[]|undefined
- Optional list of Unit Indicator colors to show in-game.
- Options are:
red
,green
, and/orblue
.
- Options are:
- If not provided, no colors will show.
- Optional list of Unit Indicator colors to show in-game.
Example Request
- Alert with Message
- Alert with Unit Indicator Colors
- Alert with specific Tone
- Full Alert
{
"message": "Ladder 7, Rescue 7. Carson Avenue intersection of Davis Avenue, Strawberry, Los Santos. Vehicle Accident, possible persons trapped. Postal 0 9 0.",
"locations": {
"Davis": ["Bay Two", "Bay Three"]
}
}
{
"locations": {
"Davis": ["Bay Two", "Bay Three"]
},
"unitcolors": ["red", "green"]
}
{
"locations": {
"Davis": ["Bay Two", "Bay Three"]
},
"tone": "Tone 2"
}
{
"message": "Ladder 7, Rescue 7. Carson Avenue intersection of Davis Avenue, Strawberry, Los Santos. Vehicle Accident, possible persons trapped. Postal 0 9 0.",
"locations": {
"Davis": ["Bay Two", "Bay Three"]
},
"tone": "Tone 2",
"unitcolors": ["red", "green"]
}
Return Value
- 200 - OK
- 400 - Bad Request
No return body, headers only
No body provided
- No request body provided.
Malformed body
- Request body didn't contain required fields, or contains irrelevant fields.
No locations provided
locations
was empty or invalid.
X is not a valid location
- Invalid location name provided.
X is not a valid door for Y
- Invalid door name provided for specific location.
X is not a valid unit indicator color
- Invalid color provided for unit indicator colors.
X is not a valid tone name. Valid tones: Y, Z
- Invalid tone provided.
- Make sure to provide the tone name and not the tone file name.
Create A New Message
Use this endpoint to send a message to one or more stations
Endpoint
POST message
Body
rawmessage
-string
- The message to send.
locations
-array
- An array of location names.
- Example:
{
"locations": ["Station One", "Station Two"]
}
Example Request
{
"rawmessage": "Could the LT please come to the office for a phone call. LT to the office for a phone call.",
"locations": ["Station One"]
}
Return Value
- 200 - OK
- 400 - Bad Request
No return body, headers only
No body provided
- No request body provided.
Malformed body
- Request body didn't contain required fields, or contains irrelevant fields.
No locations provided
locations
was empty or invalid.
X is not a valid location
- Invalid location name provided.
RawMessage cannot be empty
- Ensure you are not passing an empty string (
""
) forrawmessage
.
- Ensure you are not passing an empty string (
Locations
Get All Locations
Use this endpoint to get all locations
Endpoint
GET locations
Return Value
- 200 - OK
Get Location By Name
Use this endpoint to get a specific location by name
Endpoint
GET location/{name}
Return Value
- 200 - OK
- 400 - Bad Request
No Location Name Provided
- You must include the name of the location in the request URL.
- Example:
GET locations/Davis Station
- You can include spaces or use
%20
as a seperator
- You can include spaces or use
X is not a valid location name, valid locations names are: Y & Z
- Location name provided does not exist.
Doors
Get Doors By Location
Use this endpoint to get the states of all doors at a location
Endpoint
GET doors/{name}
Return Value
- 200 - OK
- 400 - Bad Request
Each line is an array of door names as strings
{
"open": [],
"closed": [],
"isolatedOpen": [],
"isolatedClosed": []
}
No Location Name Provided
- You must include the name of the location in the request URL.
- Example:
GET doors/Davis Station
- You can include spaces or use
%20
as a seperator
X is not a valid location name, valid locations names are: Y & Z
- Location name provided does not exist.
Update Doors
Use this endpoint to get update the doors of one or more station locations
Endpoint
POST doors
Body
open
-object
- Must be an object that contains the names of locations, and optionally a list of door names to open.
- To open all doors, pass an empty array.
- Example:
{
"open": {
"Station One": ["Bay Two", "Bay Three"],
"Station Two": [],
"Station Three": ["Bay One", "Bay Two"]
}
}
- Must be an object that contains the names of locations, and optionally a list of door names to open.
close
-object
- Must be an object that contains the names of locations, and optionally a list of door names to close.
- To close all doors, pass an empty array.
- Example:
{
"close": {
"Station One": ["Bay Two", "Bay Three"],
"Station Two": [],
"Station Three": ["Bay One", "Bay Two"]
}
}
- Must be an object that contains the names of locations, and optionally a list of door names to close.
Return Value
- 200 - OK
- 400 - Bad Request
No return body, headers only
Empty body
- No request body provided.
Malformed body
- Request body didn't contain required fields, or contains irrelevant fields.
X is not a valid location
- Invalid location name provided.
X is not a valid door for Y
- Invalid door name provided for location.
Rename Doors
Use this endpoint to rename doors at one or more locations
Endpoint
POST doors/rename
Body
locations
-object
- A list of location names with the keys being the current door name, and the value being the new name.
- Example:
{
"locations": {
"Station One": {
"Old Door name": "New Door Name"
}
}
}
Return Value
- 200 - OK
- 400 - Bad Request
No return body, headers only
Empty body
- No request body provided.
Malformed body
- Request body didn't contain required fields, or contains irrelevant fields.
No locations provided.
locations
was empty.
X is not a valid location
- Invalid location name provided.
X does not have a door names Y
- Invalid door name provided for location.