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

/schedule/next

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

Request

Method

GET

=== URL path

/schedule/next

== Response

=== Success response

==== Status code

200

==== Response format

JSON

==== Response 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.

==== team1 and team2 fields

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.

== Request

=== Method

GET

=== URL path

/bots/:bot_id

=== Request parameters

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

== Response

=== Success response

==== Status code

200

==== Response format

JSON

==== Response fields

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.

=== Error responses

==== Status code

404

==== Response format

JSON

==== Response fields

Field Type Description
error string The error message.

/schedule/<game_id>

Returns the details of a game with the specified ID.

== Request

=== Method

GET

=== URL path

/schedule/:game_id

=== Request parameters

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

== Response

=== Success response

==== Status code

200

==== Response format

JSON

==== Response 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.
winner string The ID of the winning bot, if known.
resulttext string The text result of the game, if known.

==== team1 and team2 fields

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.

=== Error responses

==== Status code

400

==== Response format

JSON

==== Response fields

/schedule/<number_to_fetch>

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

== Request

=== Method

GET

=== URL path

/schedule/:number_to_fetch

=== Request parameters

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

== Response

=== Success response

==== Status code

200

==== Response format

JSON

==== Response fields

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.

==== team1 and team2 fields

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.

=== Error responses

==== Status code

404

==== Response format

JSON

==== Response fields

Field Type Description
error string The error message.

/bots/leaderboard

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

== Request

=== Method

GET

=== URL path

/bots/leaderboard

== Response

=== Success response

==== Status code

200

==== Response format

JSON

==== Response fields

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.

=== Error responses

==== Status code

404

==== Response format

JSON

==== Response fields

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.

== Request

=== Method

GET

=== URL path

/bots/:bot_id/games

=== Request parameters

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

== Response

=== Success response

==== Status code

200

==== Response format

JSON

==== Response fields

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.

==== team1 and team2 fields

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.

=== Error responses

==== Status code

404

==== Response format

JSON

==== Response fields

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.

== Request

=== Method

POST

=== URL path

/battles/:game_id

=== Request parameters

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

=== Request body

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

Example:

{ "gameId": 123 }

== Response

=== Success response

==== Status code

200

==== Response format

JSON

==== Response fields

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

=== Error responses

==== Status code

400

==== Response format

JSON

==== Response fields

Field Type Description
error string The error message.

==== Status code

404

==== Response format

JSON

==== Response fields

Field Type Description
error string The error message.

Clone this wiki locally