Games are one of core building blocks of this API. Whilst there isn’t much you can do with game resources directly, they provide the prefix for all game-specific resources, such as servers and mods (see Game-specific URL prefixes).
What makes a resource game-specific? If the data/processes encapsulated within a resource only makes sense when attached to a specific game, then it is game-specific. For example, servers are highly game-specific because a server can only be running a single instance of a single game (not a single instance on the entire server machine of course - this just means that there can only be one game actively using the IP-port pair that forms a server identity within this API). Players, however, can interact with any game freely, as so are not game-specific.
Game info resource. Requests can be made to either /game/<gameid> or /game/<developer>/<game>. If the name is not finalised (see nameFinalised) you should use the ID to access it. Once it is finalised you should ideally use the developer/game structure, though the ID will still work. This resource is important as it provides the prefix for any other game-specific resources, such as servers and mods.
Example requests:
GET /game/1 HTTP/1.1
Host: api.kag2d.com
Accept: application/json
GET /game/thd/kag HTTP/1.1
Host: api.kag2d.com
Accept: application/json
Example response:
HTTP/1.1 200 OK
Content-Type: application/json
{
"gameInfo":
{
"description": "KAG is a 2D cooperative war game played with "
"up to 32 players. Play as Knight, Archer or Builder in a "
"large medieval world with physics allowing the "
"construction (and destruction!) of medieval fortresses.",
"developer": "THD",
"developerURL": "thd",
"gid": 1,
"name": "King Arthur's Gold",
"nameFinalised": true,
"nameURL": "kag"
}
}
Parameters: |
|
---|---|
Status Codes: |
|
Response JSON fields: | |
|