Webgateway service API

The webgateway service provides an HTTP API for third-party applications, letting your website send commands to the game or notifications to the spectator.

We require a security token for using that API. The token is passed through the “secret” header.

Notification

POST /notifications

Notifications are sent ASAP. They are not synced to the stream. Notifications sent from this endpoint will have a sessionid set to ‘web’.

Request Headers:
 
  • secret – Security token required to send requests to the service.
Request JSON Object:
 
  • notifications[] (object) – list of notification objects
  • notifications[].id (string) – The notification identifier.
  • notifications[].data (string) – The payload of the notification encoded in base 64.

Example query:

{
  "notifications": [
    {
      "id": "",
      "data": ""
    }
  ]
}

Command

POST /commands/game

A command is composed of an id-value pair. The game uses the id to identify the type of command. The value is a string that your game can parse.

Request Headers:
 
  • secret – Security token required to send requests to the service.
Request JSON Object:
 
  • id (string) – The ID the game uses to recognize the type of command.
  • value (string) – The value the game parses into a command.

Example query:

{
  "id": "",
  "value": ""
}

Event

POST /events

You can use that endpoint to send a massive amount of events to the game. It’s an alternative to directly sending events from the client in case you need to do some special work on the backend before sending the event. A maximum batch size of 2000 is accepted, otherwise the endpoint returns a code 413.

Request Headers:
 
  • secret – Security token required to send requests to the service.
Request JSON Object:
 
  • events[] (object) – The list of events.
  • events[].key[] (string) – The event key in the form of a string array.
  • events[].value (undefined) – The value the game parses into a command.

Example query:

{
  "events": [
    {
      "key": [
        "cheer"
      ],
      "value": "Porthos"
    },
    {
      "key": [
        "cheer"
      ],
      "value": "Porthos"
    },
    {
      "key": [
        "cheer"
      ],
      "value": "Aramis"
    },
    {
      "key": [
        "cheer"
      ],
      "value": "Athos"
    }
  ]
}