The base URL for the API is /api/[version]/
and the current version is 1
. The current URL would be /api/1/
We use HTTP codes to provide the query state. Every successful query will return a 200
. Every error will return a standard error code.
Every successful response will contain a root element named data
.
{
"data": "something"
}
Every error will contain a root element named error
with an error message.
{
"error": "string"
}
GET /leaderboard
Response
[{
"player_id": "string",
"name": "string",
"score": "float"
}]
GET /game/:game_id
Response
{
"id": "int",
"tick": "int",
"players": [
{
"id": "int",
"name": "string",
"total_mass": "int",
"isActive": "boolean",
"cells": [
{
"id": "int",
"mass": "int",
"radius": "int",
"position": {
"x": "float",
"y": "float"
},
"target": {
"x": "float",
"y": "float"
}
}]
}],
"resources": {
"regular": {
"position": {
"x": "float",
"y": "float"
}
},
"silver": {
"position": {
"x": "float",
"y": "float"
}
},
"gold": {
"position": {
"x": "float",
"y": "float"
}
}
},
"map": {
"width": "int",
"height": "int"
},
"viruses": [
{
"radius": "int",
"mass": "int",
"position": {
"x": "float",
"y": "float"
}
}]
}
POST /game
Request
{
"player_secret" : "string"
}
Response
{
"id": "int",
"url": "string"
}
POST /game/:game_id/action
Request
{
"player_secret": "string",
"actions": [
{
"cell_id": "int",
"burst": "bool",
"split": "bool",
"trade": "int",
"target": {
"x": "float",
"y": "float"
}
}]
}
Response
{
"data": "ok"
}
Every query will need to contain the key administratorPassword
with the right password.
{
"administrator_password": "string",
...
}
Note that putting running to false
won't have any effect. Every time this will be called
the game thread will be restarted.
PUT /admin/competition
Request
{
"running": "boolean"
}
Response
{
"data": "ok"
}
This will set the next ranked game duration(seconds).
PUT /admin/ranked
Request
{
"duration": "int"
}
Response
{
"data": "ok"
}
POST /admin/player
Request
{
"player_name": "string"
}
Response
{
"data": {
"player_secret": "string"
}
}
POST /admin/player
Request
{
"seed": "boolean"
}
Response
{
"data": "ok"
}