Skip to content
Soarez edited this page Aug 14, 2012 · 8 revisions

ZD Backend API spec

POST /games

Start -- Create a game.

Request
{
  "nickname": "Rulio"
}
Response

This is the result

{
  "id": "PbDHs",
  "nickname": "Rulio",
  "score": 0,
  
  "brains": ["yellow"],
  "shots": ["red"],
  "runners": ["green"]
}

The last three fields are arrays of the dice's colors.

PUT /game/id

Play -- Update the game state.

Request
{
  "id": "PbDHs",
  "nickname": "Rulio",
  "action": "roll",
  
  "score": 0,
  "brains": ["yellow"],
  "shots": ["red"],
  "runners": ["green"]
}

The server only cares about the three first fields. The nickname can be updated. The action, if any, can be either roll or stop.

Response
{
  "id": "PbDHs",
  "nickname": "Rulio",
  
  "score": 0,
  "brains": ["yellow", "green", "green"],
  "shots": ["red", "yellow"],
  "runners": []
}
Clone this wiki locally