API¶
-
GET
/game-config/{team}
¶ Get a game from the team name.
Parameters: - team (string) – The name of the team
Status Codes: - 200 OK – Return the game.
- 404 Not Found – The game is not found.
Response JSON Object: - duration (integer) – The game duration in minute
- remaining (integer) – The remaining time in minute
- start_at (string) – The starting date
- state (string) – The state of game
- team (string) – (required) The name of team
- teams_members[].difficulty (string) – The difficulty of puzzle set chosen by the team member.
- teams_members[].id (integer) – (generated) The id of teams member
- teams_members[].level (integer) – The start level chosen by the team member
- teams_members[].level_max (integer) – The last level
- teams_members[].level_obj.level (integer) – The current level
- teams_members[].level_obj.theme (string) – The current theme
- teams_members[].name (string) – (required) The name of teams member
- teams_members[].theme (string) – The theme of puzzle chosen by the team member.
- won_at (string) – The date of victory in ISO 8601 format
-
DELETE
/game-config/{team}
¶ Delete the game from the team name.
Parameters: - team (string) – The name of the team
Status Codes: - 200 OK – The game is deleted.
- 404 Not Found – The game is not found.
-
GET
/game-config
¶ List all game.
Status Codes: - 200 OK – Return a list of game.
Response JSON Object: - [].duration (integer) – The game duration in minute
- [].remaining (integer) – The remaining time in minute
- [].start_at (string) – The starting date
- [].state (string) – The state of game
- [].team (string) – (required) The name of team
- [].teams_members[].difficulty (string) – The difficulty of puzzle set chosen by the team member.
- [].teams_members[].id (integer) – (generated) The id of teams member
- [].teams_members[].level (integer) – The start level chosen by the team member
- [].teams_members[].level_max (integer) – The last level
- [].teams_members[].level_obj.level (integer) – The current level
- [].teams_members[].level_obj.theme (string) – The current theme
- [].teams_members[].name (string) – (required) The name of teams member
- [].teams_members[].theme (string) – The theme of puzzle chosen by the team member.
- [].won_at (string) – The date of victory in ISO 8601 format
-
POST
/game-config
¶ Create a new game.
Create a new game, The game will be identified by the name of the team. Each game has one uniq team. when the game is created, you should start it using PUT request on /game-config/{team}/start route
Request JSON Object: - team (string) – (required) The name of team
- teams_members[].difficulty (string) – The difficulty of puzzle set chosen by the team member.
- teams_members[].level (integer) – The start level chosen by the team member
- teams_members[].level_max (integer) – The last level
- teams_members[].name (string) – (required) The name of teams member
- teams_members[].theme (string) – The theme of puzzle chosen by the team member.
Example request:
POST /game-config HTTP/1.1 Host: example.com Content-Type: application/json { "team": "team-17", "team_members": [{ "name": "Toto" }], "duration": 10 }
Status Codes: - 201 Created – The game is created.
- 409 Conflict –
The team already has a game.
Example response:
HTTP/1.1 409 Conflict Content-Type: application/json { "team": "team-17", "team_members": [{ "name": "Toto", "id": 2013, "levels_obj": { "level": 2, "theme": "laby" }, "level": 1, "level_max": 2 }], "duration": 10, "state": "ready" }
Response JSON Object: - duration (integer) – The game duration in minute
- remaining (integer) – The remaining time in minute
- start_at (string) – The starting date
- state (string) – The state of game
- team (string) – (required) The name of team
- teams_members[].difficulty (string) – The difficulty of puzzle set chosen by the team member.
- teams_members[].id (integer) – (generated) The id of teams member
- teams_members[].level (integer) – The start level chosen by the team member
- teams_members[].level_max (integer) – The last level
- teams_members[].level_obj.level (integer) – The current level
- teams_members[].level_obj.theme (string) – The current theme
- teams_members[].name (string) – (required) The name of teams member
- teams_members[].theme (string) – The theme of puzzle chosen by the team member.
- won_at (string) –
The date of victory in ISO 8601 format
Example response:
HTTP/1.1 201 Created Content-Type: application/json { "team": "team-17", "team_members": [{ "name": "Toto", "id": 2013, "levels_obj": { "level": 2, "theme": "laby" }, "level": 1, "level_max": 2 }], "duration": 10, "state": "ready" }
-
PUT
/game-config/{team}/start
¶ Start a created game configuration selected by team.
Parameters: - team (string) – The name of the team
Status Codes: - 200 OK – The game is started.
- 404 Not Found – The game is not found.
- 409 Conflict – The game is already started or stopped.
Response JSON Object: - duration (integer) – The game duration in minute
- remaining (integer) – The remaining time in minute
- start_at (string) – The starting date
- state (string) – The state of game
- team (string) – (required) The name of team
- teams_members[].difficulty (string) – The difficulty of puzzle set chosen by the team member.
- teams_members[].id (integer) – (generated) The id of teams member
- teams_members[].level (integer) – The start level chosen by the team member
- teams_members[].level_max (integer) – The last level
- teams_members[].level_obj.level (integer) – The current level
- teams_members[].level_obj.theme (string) – The current theme
- teams_members[].name (string) – (required) The name of teams member
- teams_members[].theme (string) – The theme of puzzle chosen by the team member.
- won_at (string) – The date of victory in ISO 8601 format
-
PUT
/game-config/{team}/add-member
¶ Add a new member to the game.
Parameters: - team (string) – The name of the team
Request JSON Object: - difficulty (string) – The difficulty of puzzle set chosen by the team member.
- level (integer) – The start level chosen by the team member
- level_max (integer) – The last level
- name (string) – (required) The name of teams member
- theme (string) – The theme of puzzle chosen by the team member.
Status Codes: - 200 OK – The team member is added.
- 404 Not Found – The game is not found.
- 409 Conflict – The game is already started or stopped.
Response JSON Object: - duration (integer) – The game duration in minute
- remaining (integer) – The remaining time in minute
- start_at (string) – The starting date
- state (string) – The state of game
- team (string) – (required) The name of team
- teams_members[].difficulty (string) – The difficulty of puzzle set chosen by the team member.
- teams_members[].id (integer) – (generated) The id of teams member
- teams_members[].level (integer) – The start level chosen by the team member
- teams_members[].level_max (integer) – The last level
- teams_members[].level_obj.level (integer) – The current level
- teams_members[].level_obj.theme (string) – The current theme
- teams_members[].name (string) – (required) The name of teams member
- teams_members[].theme (string) – The theme of puzzle chosen by the team member.
- won_at (string) – The date of victory in ISO 8601 format
-
PUT
/asterios/{team}/member/{memberId}/puzzle
¶ Get puzzle of current level. A new puzzle is generated for each request.
Parameters: - team (string) – The name of the team
- member id (string) – The id of the team member
Status Codes: - 200 OK – Question is generated and returned.
- 404 Not Found –
The game or team member doesn’t exist.
Example response:
HTTP/1.1 404 Not Found Content-Type: application/json { "puzzle": ["lmn", "fhj", "jih"], "tip": "ace -> g" }
- 409 Conflict –
The game is not running.
Example response:
HTTP/1.1 409 Conflict Content-Type: application/json { "puzzle": ["lmn", "fhj", "jih"], "tip": "ace -> g" }
Response JSON Object: - puzzle (any) – The puzzle to resolve.
- tip (string) –
A tip to resolve the puzzle.
Example response:
HTTP/1.1 200 OK Content-Type: application/json { "puzzle": ["lmn", "fhj", "jih"], "tip": "ace -> g" }
-
PUT
/asterios/{team}/member/{memberId}/solve
¶ Try to solve the puzzle.
Parameters: - team (string) – The name of the team
- member id (string) – The id of the team member
Status Codes: - 200 OK – The puzzle is solved.
- 404 Not Found – The game or team member doesn’t exist.
- 409 Conflict – The game is not running.
- 420 – The puzzle isn’t solved.