Skip to content

Uploading to Splashcat

kitt edited this page Jul 23, 2023 · 5 revisions

Uploading to Splashcat

Splashcat's ingest endpoint is at https://splashcat.ink/battles/api/upload/. It takes in a JSON object.

Valid content types are application/json and application/x-msgpack/application/x-messagepack. In the case of the latter, the request body must be encoded using MessagePack.

Requests must be authenticated using an API Key. This key can be obtained by logging in to Splashcat and going to the settings page. API Keys are sent in HTTP headers as Authorization: Bearer <API Key>.

The request body can contain the following parameters.

{
  "battle": {}, // required, see more below
  "data_type": "splashcat", // required, must be `splashcat`
  "uploader_agent": {
    "name": "", // max of 32 characters
    "version": "", // max of 50 characters
    "extra": "" // max of 100 characters. displayed as a string at the bottom of battle details. useful for debug info such as manual/monitoring modes
  }
}

The battle key contains the battle's details. This is easiest seen here https://json-schema.app/view/%23?url=https://raw.githubusercontent.com/splashcat-ink/splashcat/main/battles/format_schemas/splashcat.schema.json

The raw JSON schema is at https://splashcat.ink/battles/api/schemas/splashcat.schema.json

Improving Performance

For POST requests to Splashcat, requests should include a fly-prefer-region header set to iad. This reduces latency by preventing the request from having to be replayed by a machine in the user's region. See Fly.io documentation for details.

Listing uploaded battles

The endpoint https://splashcat.ink/battles/api/recent/ requires the same authorization header as above. It returns a JSON object containing the SplatNet 3 battle ids submitted above. This should be use to prevent sending of duplicate data.

Example Response

{
  "battle_ids": [
    "20230703T043931_6d940bc6-705d-4164-bd03-f53f4b3091e2",
    "20230703T043135_b537fec0-cf59-4868-8687-661be1d4bef2",
    "..."
  ]
}
Clone this wiki locally