Skip to content

API (Saint)

t edited this page Mar 17, 2021 · 5 revisions

Since CSV dumps aren't a thing yet you can use the Saint private1 API to get cutoff information.

To retrieve basic info for the current event:

GET /api/private/saint/[sid]/current/setup.json

{
    "result": {
        "event_id": 30007,
        "start_time": "2020-01-22T06:00:00",
        "end_time": "2020-01-31T06:00:00",
        "result_time": "2020-01-31T09:00:00",
        "title_image": "https://tirofinale.kirara.ca/i/557a21/v1WbFPCgEa166Q.png"
    }
}

where sid is a server ID. The available server IDs are "jp" and "en".

You can also substitute "current" for an event ID to get the same information for that event.

To get tier information for an event:

GET /api/private/saint/[sid]/[eid]/tiers.json?back=1

{
    "result": {
        "is_new": true,
        "datasets": {
            "points.1000": [
                [
                    1579674545.991459,
                    22068
                ],
                ...
            ],
            "points.3000": [
                [
                    1579674545.991459,
                    8323
                ],
                ...
            ],
        }
    }
}

where sid is a server ID and eid is an event ID. Unlike the setup API, there is no magic value to request the current event.

You can specify either ?back=[hours] or ?after=[timestamp] to control the data you get back. If after is specified, the server only returns data observed after that time, and is_new will be false. If back is specified, or neither is specified, the server returns the last N hours worth of data. The default is 24 hours. If the timestamp you provide for ?after is too far away from the current time, it is treated as back=24 and the is_new flag will be set to true to indicate this.

Note: responses from a ?back request may be stale for performance reasons. If you intend to get the latest status, make a secondary ?after request to ensure the data is up to date.

Note 2: Standard tier data is currently not available for events of type "coop". For these events, you must use the top10 endpoint to fetch voltage rankings.

You can also retrieve datasets for the top 20 positions in the ranking with the top10.json endpoint:

GET /api/private/saint/[sid]/[eid]/top10.json?back=1

{
    "result": {
        "is_new": true,
        "datasets": {
            "points.1": [
                [
                    1579674545.991459,
                    22068,
                    "Heartless"
                ],
                ...
            ],
            "points.2": [
                [
                    1579674545.991459,
                    8323,
                    "Nobody"
                ],
                ...
            ],
        }
    }
}

Specific to this endpoint is third value in each data point: it is the name of the player currently occupying the position.

Note: For events before 20/09/2020, positions 11 to 20 were not recorded. In this case data points will still be returned, but the point value and player name will be null.

Note 2: For events before 20/09/2020, player names were also not recorded. For the top 10 positions (which have valid point data), the name will be substituted with the string "???".

1: In this case, private means that functionality and shape of the API may change at any time.

Clone this wiki locally