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.
- 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.
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.
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.