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

# /schedule/next

Returns the details of the next scheduled game that has not yet been played.

GET

/schedule/next

200

JSON

| Field | Type | Description | |—————|——–|———————————————| | gameId | int | The unique ID of the game. | | team1 | object | The details of team 1 in the game. | | team2 | object | The details of team 2 in the game. |

| Field | Type | Description | |———————|——–|——————————————————| | name | string | The name of the bot representing the team. | | battleCapability | int | The battle capability of the bot representing the team. | | wins | int | The number of wins for the bot. | | losses | int | The number of losses for the bot. | | botId | string | The unique ID of the bot. | | imageId | string | The unique ID of the bot’s image. |

# /bots/<bot_id>

Returns the details of a bot with the specified ID.

GET

/bots/:bot_id

bot_id (required): The unique ID of the bot to retrieve.

200

JSON

| Field | Type | Description | |———————|——–|——————————————————| | name | string | The name of the bot. | | battleCapability | string | The battle capability of the bot. | | wins | int | The number of wins for the bot. | | losses | int | The number of losses for the bot. | | botId | string | The unique ID of the bot. | | imageId | string | The unique ID of the bot’s image. |

404

JSON

| Field | Type | Description | |——–|——–|———————–| | error | string | The error message. |

# /schedule/<game_id>

Returns the details of a game with the specified ID.

GET

/schedule/:game_id

game_id (required): The unique ID of the game to retrieve.

200

JSON

| Field | Type | Description | |—————|——–|———————————————| | gameId | int | The unique ID of the game. | | team1 | object | The details of team 1 in the game. | | team2 | object | The details of team 2 in the game. | | winner | string | The ID of the winning bot, if known. | | resulttext | string | The text result of the game, if known. |

| Field | Type | Description | |———————|——–|——————————————————| | name | string | The name of the bot representing the team. | | battleCapability | string | The battle capability of the bot representing the team. | | wins | int | The number of wins for the bot. | | losses | int | The number of losses for the bot. | | botId | string | The unique ID of the bot. | | imageId | string | The unique ID of the bot’s image. |

400

JSON

# /schedule/<number_to_fetch>

Returns the details of the next scheduled games that have not yet been played, up to the specified number.

GET

/schedule/:number_to_fetch

number_to_fetch (required): The number of games to retrieve.

200

JSON

An array of game objects, each with the following fields:

| Field | Type | Description | |—————|——–|———————————————| | gameId | int | The unique ID of the game. | | team1 | object | The details of team 1 in the game. | | team2 | object | The details of team 2 in the game. |

| Field | Type | Description | |———————|——–|——————————————————| | name | string | The name of the bot representing the team. | | battleCapability | string | The battle capability of the bot representing the team. | | wins | int | The number of wins for the bot. | | losses | int | The number of losses for the bot. | | botId | string | The unique ID of the bot. | | imageId | string | The unique ID of the bot’s image. |

404

JSON

| Field | Type | Description | |——–|——–|———————–| | error | string | The error message. |

# /bots/leaderboard

Returns a leaderboard of the top bots based on their number of wins.

GET

/bots/leaderboard

200

JSON

An array of bot objects, each with the following fields:

| Field | Type | Description | |—————|——–|————————————-| | botId | string | The unique ID of the bot. | | wins | int | The number of wins for the bot. | | losses | int | The number of losses for the bot. |

404

JSON

| Field | Type | Description | |——–|——–|———————–| | error | string | The error message. |

# /bots/<bot_id>/games

Returns a list of all games that the specified bot has played in.

GET

/bots/:bot_id/games

bot_id (required): The unique ID of the bot.

200

JSON

An array of game objects, each with the following fields:

| Field | Type | Description | |—————|——–|———————————————| | gameId | int | The unique ID of the game. | | team1 | object | The details of team 1 in the game. | | team2 | object | The details of team 2 in the game. |

| Field | Type | Description | |———————|——–|——————————————————| | name | string | The name of the bot representing the team. | | battleCapability | string | The battle capability of the bot representing the team. | | wins | int | The number of wins for the bot. | | losses | int | The number of losses for the bot. | | botId | string | The unique ID of the bot. | | imageId | string | The unique ID of the bot’s image. |

404

JSON

| Field | Type | Description | |——–|——–|———————–| | error | string | The error message. |

# /battles/<game_id>

Runs a battle between the two bots of a game and returns the winner and the result text.

POST

/battles/:game_id

game_id (required): The unique ID of the game.

The request body must be a JSON object with a gameId field set to the ID of the game.

Example:

{ “gameId”: 123 }

200

JSON

| Field | Type | Description | |————–|——–|———————————————| | winner | string | The unique ID of the winning bot. | | resulttext | string | The result text generated by OpenAI API. |

400

JSON

| Field | Type | Description | |——–|——–|———————–| | error | string | The error message. |

404

JSON

| Field | Type | Description | |——–|——–|———————–| | error | string | The error message. |

Clone this wiki locally