Retrieve list of available public tournament
GET
/tournament
name value type description type page
Integer the current page Optional page-size
Integer the number of items per page, defaults to 10, maximum 50 Optional display-private
none display private tournament Optional display-completed
none display completed tournament Optional
http code content-type response 200
application/json
{"public-tournaments": [tournament1, ...]}
401
application/json
{"errors":["AAA", ...]}
Create a new tournament
POST
/tournament
- Tournament name must be between 3 and 20 characters and can only contain alnum and space
- Players must be between 2 and 16 (optional, default = 16 players)
- Nickname for the tournament (optional)
- A boolean that specifies if tournament is private
- A password for the tournament (if is-private is true)
{ "name": "World Championship", "max-players": 16, "is-private": true, "password": "Password1%" "nickname": "Player" }
http code content-type response 201
application/json
{"id": 1, "name": "Tournament", ...}
400
/401
application/json
{"errors": ["AAA", "BBB", "..."]}
Delete all tournaments created by the user (with status created
)
DELETE
/tournament
None
http code content-type response 200
application/json
{"message": "tournaments created by this user have been deleted"}
401
application/json
{"errors": ["error message", ...]}
Get your active tournaments
GET
/tournament/self/ongoing
None
http code content-type response 201
application/json
{"nb_active_tournaments": 2, "active_tournaments": [...]}
400
/401
application/json
{"errors": ["AAA", "BBB", "..."]}
Retrieve details of specific tournament
GET
/tournament/{id}
None
Body
{ "id": 1, "name": "Tournament", "max-players": 16, "nb-players": 1, "players": [ { "nickname": "Player", "user_id": 2 } ], "is-private": true, "status": "created", "admin": "edelage",
http code content-type response 200
application/json
{"id": 1, "name": "Tournament", ...}
404
application/json
{"errors": ["error message", ...]}
Delete a tournament
DELETE
/tournament/{id}
None
http code content-type response 200
application/json
{"message": "tournament successfully deleted"}
400
/401
/403
/404
application/json
{"errors": ["error message", ...]}
Update tournament settings
PATCH
/tournament/{id}
- Tournament name must be between 3 and 20 characters and can only contain alnum and space (optional)
- Players must be between 2 and 16 (optional)
- A boolean that specifies if tournament is private (optional)
- A password for the tournament (optional)
{ "name": "World Championship", "max-players": 16, "is-private": true, "password": "Password1%" }
http code content-type response 200
application/json
{"id": 1, "name": "Tournament", ...}
400
/403
application/json
{"errors": ["AAA", "BBB", "..."]}
Start a tournament
PATCH
/tournament/{id}/start
None
http code content-type response 200
application/json
{"message": "..."}
400
application/json
{"errors": ["AAA", "BBB", "..."]}
Retrieve the list of players for a tournament
GET
/tournament/{id}/players
{ "max-players": 16, "players": [ { "nickname": "Player", "user_id": 2 } ] }
http code content-type response 200
application/json
{"players": [{"nickname": "Player", ...}, ...]}
404
application/json
{"errors": ["AAA", ...]}
Add a player to a specific tournament
POST
/tournament/{id}/players
- Nickname for the tournament
- The tournament password (if tournament is private)
{ "nickname": "Player" }
http code content-type response 201
application/json
{"id": 1, "nickname": "Player", "user_id": 2}
400
/403
/404
application/json
{"errors": ["AAA", "BBB", "..."]}
Leave a tournament
DELETE
/tournament/{id}/players
None
http code content-type response 200
application/json
{"players": [{"nickname": "Player", ...}, ...]}
404
application/json
{"errors": ["AAA", ...]}
Anonymizes a user's nicknames
POST
/tournament/player/anonymize
- The user id to anonymize
{ "user_id": 1 }
http code content-type response 200
application/json
{"message": "player successfully anonymized"}
Kick a player from a tournament
DELETE
/tournament/{tournament_id}/player/{user_id}
None
http code content-type response 200
application/json
{"message": "You kicked the player with id
{user_id}"}
400
application/json
{"errors": ["AAA", "BBB", "..."]}
Retrieve the list of matches for a tournament
GET
/tournament/{id}/matches
None
Example:
{ "nb-matches": 14, "matches": [ { "id": 1, "status": "Finished", "player1": "Player1", "player2": "Player2", "player_1_score": 2, "player_2_score": 1, "winner": "Player1" }, { ... } ] }
Generate matches for a tournament
POST
/tournament/{id}/matches/generate
- Randomly generate matches (optional, default = false)
{ "random": true }
http code content-type response 200
application/json
{"nb-matches": 14, "matches": [...]}
404
application/json
{"errors": ["AAA", ...]}
Retrieve details of a match
GET
/tournament/{id}/match/{match-id}
None
Example:
{ "id": 1, "status": "Finished", "player1": "Player1", "player2": "Player2", "player_1_score": 2, "player_2_score": 1, "winner": "Player1" }
http code content-type response 200
application/json
{"id": 1, "status": "In-progress", ...}
404
application/json
{"errors": ["AAA", ...]}
Start a match
POST
/tournament/{id}/match/start
- The first player (user_id)
- The second player (user_id)
{ "player1": 1, "player2": 2 }
http code content-type response 200
application/json
{"id": 1, "status": "In-progress", ...}
400
application/json
{"errors": ["AAA", "BBB", "..."]}
Add one point to a player
POST
/tournament/{id}/match/add-point
- The player to add a point (user_id)
{ "player": 1 }
http code content-type response 200
application/json
{"id": 1, "status": "In-progress", ...}
400
application/json
{"errors": ["AAA", "BBB", "..."]}
End a match
POST
/tournament/{id}/match/end
- Winner of the match (user_id)
{ "winner": 2 }
http code content-type response 200
application/json
{"id": 1, "status": "Finished", ...}
400
application/json
{"errors": ["AAA", "BBB", "..."]}
Delete inactive tournaments