Skip to content
tommywaaf edited this page Feb 18, 2023 · 36 revisions

API endpoints DNS killhitstudios example endpoint /nhttp://killhitstudios.com:5000/getgamedata/2 /nhttp://killhitstudios.com:5000/getbotimage/4

Endpoint: /getnextgame

Description:

Returns details about the next game with no winner, including the details of the two bots competing.

Request:

GET /getnextgame

Response:

HTTP 200 OK Content-Type: application/json

{
    "gameId": 123,
    "team1": {
        "name": "Bot A",
        "battleCapability": "string of text",
        "wins": 5,
        "losses": 2,
        "botId": "1",
        "imageId": "xyz123"
    },
    "team2": {
        "name": "Bot B",
        "battleCapability": "string of text",
        "wins": 7,
        "losses": 1,
        "botId": "2",
        "imageId": "abc456"
    }
}

Endpoint: /getbotimage/<bot_id>

Description:

Returns the image data for the bot with the specified bot_id.

Request:

GET /getbotimage/2

Response:

HTTP 200 OK Content-Type: image/png

<Image data for bot with bot_id "2">

Endpoint: /getbotdata/<bot_id>

This endpoint returns the details for the bot with the specified bot_id.

Response Example

{
    "botId": "1",
    "name": "Bot 1",
    "battleCapability": "string of text",
    "wins": 5,
    "losses": 3,
    "imageId": "5e8b3f3c086f9a6d4a6b4f6c"
}

Endpoint: /getgamedata/<game_id>

This endpoint returns the details for the game with the specified game_id.

Response Example

{
"gameId": 1,
"team1": "botId",
"team2": "botId",
"winner": "botId",
"resulttext": "Bot 1 won the battle!"
}

Endpoint: /getnext20games

Description

Returns details about the next 20 games with no winner.

Response Example

{
"games": [
{
"gameId": 1,
"team1": "1",
"team2": "2"
},
{
"gameId": 2,
"team1": "2",
"team2": "4"
},

]
}

Endpoint: /getleaderboard

Description

Returns a leaderboard of the top 15 bots with the most wins.

Response Example

{
"leaderboard": [
{
"botId": "1",
"wins": 10
},
{
"botId": "2",
"wins": 9
},

]
}

Endpoint: /getallbotgames/<bot_id>

Description

Returns details about all games where the bot with the specified bot_id is a player.

Response Example

{
"games": [
{
"gameId": 1,
"team1": "0001",
"team2": "0002",
"winner": "0001",
"resultText": "Bot 1 won the battle!"
},
{
"gameId": 2,
"team1": "0001",
"team2": "0003",
"winner": "0003",
"resultText": "Bot 3 won the battle!"
},

]
}

Endpoint: /postgeneratebattle

This endpoint generates the result of a battle between two bots and returns the result text and the winner. The gameId for the game to be generated must be included in the request body as a JSON object.

Request Example:

{
    "gameId": 1
}

Response Example:

{
    "resulttext": "Bot 1 won the battle!",
    "winner": "0001"
}

Clone this wiki locally