Servers are game-specific entities, so all resources in this section are game-specific themselves (see: Game-specific URL prefixes).
[TODO: Flesh this section out]
Server status retrieval resource. Note that the game specified by the prefix must match the game that the server being requested is running.
Example request:
GET /game/thd/kag/server/192.0.2.3/50301/status HTTP/1.1
Host: api.kag2d.com
Accept: application/json
Example response:
HTTP/1.1 200 OK
Content-Type: application/json
{
"serverStatus": {
"DNCycle": true,
"DNState": 0,
"IPv4Address": "192.0.2.3",
"IPv6Address": null,
"build": 999,
"connectable": true,
"currentPlayers": 2,
"description": "Some description of the server",
"firstSeen": "2013-12-08 19:24:55",
"gameMode": "Sandbox",
"gameState": 1,
"gameID": 1,
"gold": true,
"lastUpdate": "2013-12-08 19:24:55",
"mapH": 150,
"mapW": 150,
"maxPlayers": 10,
"maxSpectatorPlayers": 2,
"modsVerified": false,
"name": "Some server name",
"password": true,
"playerList": [
"Shadlington",
"Troll"
],
"playerPercentage": 0.2,
"port": 50301,
"preferAF": 4,
"reservedPlayers": 2,
"spectatorPlayers": 0,
"usingMods": false
}
}
Parameters: |
|
---|---|
Status Codes: |
|
Response JSON fields: | |
|
Server status update resource. Note that the server will be updated as running the game that is specified in the prefix.
Example request:
PUT /game/thd/kag/server/192.0.2.3/50301/status HTTP/1.1
Host: api.kag2d.com
Content-Type: application/json
{
"serverStatus": {
"DNCycle": true,
"DNState": 0,
"IPv4Address": "192.0.2.3",
"IPv6Address": null,
"build": 999,
"currentPlayers": 2,
"description": "Some description of the server",
"gameMode": "Sandbox",
"gameState": 1,
"gold": true,
"mapH": 150,
"mapW": 150,
"maxPlayers": 10,
"maxSpectatorPlayers": 2,
"modsVerified": false,
"name": "Some server name",
"password": true,
"playerList": {
"Shadlington": "placeholder",
"Troll": "placeholder"
},
"port": 50301,
"preferAF": 4,
"reservedPlayers": 2,
"spectatorPlayers": 0,
"usingMods": false
}
}
Example response:
HTTP/1.1 200 OK
Content-Type: application/json
{}
Parameters: |
|
---|---|
Status Codes: |
|
Substatus 20001: | |
you authorised another IP but you still need to call from it to be able to use it to identify the server (in the URL). The IP you authorised/need to call from is in the ‘callbackSource’ key of the response body. |
|
Substatus 20002: | |
the update was successful but the server is not connectable for some reason, and won’t appear in the in-game client server list. |
|
Substatus 40303: | |
the IP you called from isn’t authorised for the server you are updating. You need to update the server from an authorised IP (the one to use will be in the ‘callbackSource’ key of the response body), specifying the IP to authorise in the request body. |
|
Request JSON fields: | |
|
Server minimap retrieval resource. When successful (i.e. 200) the response body is a PNG file. Note that the game specified by the prefix must match the game that the server being requested is running.
Example request:
GET /game/thd/kag/server/192.0.2.3/50301/minimap HTTP/1.1
Host: api.kag2d.com
Accept: image/png
Example response:
HTTP/1.1 200 OK
Content-Type: image/png
[Some PNG file data]
Parameters: |
|
---|---|
Status Codes: |
|
Server minimap update resource. Note that the game specified by the prefix must match the game that the server (for which the minimap is being updated) is running.
Example request:
PUT /game/thd/kag/server/192.0.2.3/50301/minimap HTTP/1.1
Host: api.kag2d.com
Content-Type: image/png
Example response:
HTTP/1.1 200 OK
Content-Type: image/png
{
"statusMessage": "2801 byte minimap successfully saved"
}
Parameters: |
|
---|---|
Status Codes: |
|
Server list resource. This is a list resource and therefore the notes in the introduction concerning list resources are relevant here: List type resources. Note that the server list will be filtered down to servers running the game specified by the prefix.
Special filter: If you specify a filter with the field ‘current’ and a value of either true or false (the operator is always eq) then the server list will be filtered to servers that have been updated within the last 32 seconds - i.e. currently active servers.
Example URL:
/game/thd/kag/servers?filters=[{“field”: “build”, “op”: “eq”, “value”: 590}]&limit=5&start=10
Example request:
GET /game/thd/kag/servers HTTP/1.1
Host: api.kag2d.com
Accept: application/json
Example response:
HTTP/1.1 200 OK
Content-Type: application/json
{
"serverList": [
{
"DNCycle": true,
"DNState": 0,
"IPv4Address": "192.0.2.3",
"IPv6Address": null,
"build": 999,
"connectable": true,
"currentPlayers": 2,
"description": "Some description of the server",
"firstSeen": "2013-12-08 19:24:55",
"gameMode": "Sandbox",
"gameState": 1,
"gameID": 1,
"gold": true,
"lastUpdate": "2013-12-08 19:24:55",
"mapH": 150,
"mapW": 150,
"maxPlayers": 10,
"maxSpectatorPlayers": 2,
"modsVerified": false
"name": "Some server name",
"password": true,
"playerList": [
"Shadlington",
"Troll"
],
"playerPercentage": 0.2,
"port": 50301,
"preferAF": 4,
"reservedPlayers": 2,
"spectatorPlayers": 0,
"usingMods": false
},
{
anotherserver (same format as above)
}
]
}
Query Parameters: | |
---|---|
|
|
Status Codes: |
|
Response JSON fields: | |
|
Server list filter info resource This is a list filterinfo resource and therefore the notes in the introduction concerning list resources are relevant here: List type resources. Note that the game prefix currently doesn’t do anything for this resource (though will eventually cause the resource to return only the filters relevant to the specified game).
Example request:
GET /game/thd/kag/servers/filterinfo HTTP/1.1
Host: api.kag2d.com
Accept: application/json
Example response:
HTTP/1.1 200 OK
Content-Type: application/json
{
"serverListFilterFields": [
{
"name": "gold",
"type": "int"
},
{
"name": "usingMods",
"type": "int"
},
{
"name": "modsVerified",
"type": "int"
},
{
"name": "mapH",
"type": "int"
},
{
"name": "spectatorPlayers",
"type": "int"
},
{
"name": "maxPlayers",
"type": "int"
},
{
"name": "preferAF",
"type": "int"
},
{
"name": "gameState",
"type": "int"
},
{
"name": "mapW",
"type": "int"
},
{
"name": "port",
"type": "int"
},
{
"name": "connectable",
"type": "int"
},
{
"alias": "name",
"name": "serverName",
"type": "string"
},
{
"name": "currentPlayers",
"type": "int"
},
{
"name": "DNCycle",
"type": "int"
},
{
"name": "build",
"type": "int"
},
{
"name": "playerPercentage",
"type": "float"
},
{
"name": "lastUpdate",
"type": "datetime"
},
{
"name": "gameMode",
"type": "string"
},
{
"name": "description",
"type": "string"
},
{
"name": "sid",
"type": "string"
},
{
"name": "maxSpectatorPlayers",
"type": "int"
},
{
"name": "reservedPlayers",
"type": "int"
},
{
"name": "password",
"type": "int"
},
{
"name": "firstSeen",
"type": "datetime"
},
{
"alias": "IPv4Address",
"name": "IPv4",
"type": "string"
},
{
"alias": "IPv6Address",
"name": "IPv6",
"type": "string"
},
{
"name": "DNState",
"type": "int"
},
{
"info": "If true, filter to active servers",
"name": "current",
"ops": "eq",
"type": "bool"
}
],
"serverListFilterOperators": [
{
"meaning": ">",
"name": "gt"
},
{
"meaning": "<",
"name": "lt"
},
{
"meaning": "!=",
"name": "ne"
},
{
"meaning": ">=",
"name": "ge"
},
{
"meaning": "<=",
"name": "le"
},
{
"meaning": "=",
"name": "eq"
}
]
}
Status Codes: |
|
---|---|
Response JSON fields: | |
|