Skip to main content

API

This page documents the HTTP endpoints for SA.

info

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"]
      }
      }
  • message - string|undefined
    • Optional message to be read out via Text-to-Speech.
      • Requires Voice Turnout Addon, see here for details.
  • 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/or blue.
    • If not provided, no colors will show.

Example Request

{
"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"]
}
}

Return Value

No return body, headers only


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

No return body, headers only


Locations

Get All Locations

Use this endpoint to get all locations

Endpoint

GET locations

Return Value


Get Location By Name

Use this endpoint to get a specific location by name

Endpoint

GET location/{name}

Return Value


Doors

Get Doors By Location

Use this endpoint to get the states of all doors at a location

Endpoint

GET doors/{name}

Return Value

Each line is an array of door names as strings

{
"open": [],
"closed": [],
"isolatedOpen": [],
"isolatedClosed": []
}

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"]
      }
      }
  • 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"]
      }
      }

Return Value

No return body, headers only


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

No return body, headers only