Compendium Bot API

The Compendium Bot provides a simple API that can be used to retrieve a user's data from the bot.

To enable use of the api, an api key is required. This can be created by executing the %apikey bot command. Only users with administrative access to the server can create an api key. Creating a new apikey will deactivate any previously created api key.

tech api

The tech data for a user can be retrieved from the bot using the following url:

GET https://bot.hs-compendium.com/compendium/api/tech?token=<apikey>&userid=<userid>

Replace <apikey> with the value provided by the %apikey command, and <userid> with the discord user id.

On success, the api will return with http code 200 and a structure similar to the following, where the data are presented in both array and map form:

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
    "map": {
        "transp": {
            "level": 5,
            "ws": 2000
        },
        "miner": {
            "level": 5,
            "ws": 4000
        },
        "bs": {
            "level": 5,
            "ws": 7000
        },
        "battery": {
            "level": 9,
            "ws": 750
        },
        "teleport": {
            "level": 8,
            "ws": 625
        }
    },
    "array": [
        {
            "type": "transp",
            "level": 5,
            "ws": 2000
        },
        {
            "type": "miner",
            "level": 5,
            "ws": 4000
        },
        {
            "type": "bs",
            "level": 5,
            "ws": 7000
        },
        {
            "type": "battery",
            "level": 9,
            "ws": 750
        },
        {
            "type": "teleport",
            "level": 8,
            "ws": 625
        }
    ]
}
                

In the event of an error, the following structure will be returned:

 {
     "code": 400,
     "error": "Invalid Token",
     "type": 4
}
                

HTTP Code will be an error code in the 400 range. The error "type" will be one of the following values:

1 = User ID was not specified
2 = The user was not found or there is no data for the user
3 = The user has no tech records
4 = The token is invalid
                

© 2019-2020 R. Goldstein / McGoldric Apps

All Rights Reserved.