-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Gabriel Sousa edited this page Nov 22, 2020
·
23 revisions
COVIDA provide, via a web interface, information about games and manage groups of favourite games.
The base URI for the COVIDA API is /covida
.
COVIDA api uses json format for every request and response that have content on body.
The next section describes the API's available end points.
GET /covida/topgames
-
Request:
- URL example:
http://localhost:8000/covida/topgames?limit=1
- Path parameters: None
- Query string:
- limit - the maximum number of games returned
- Body: None
- URL example:
-
Response:
-
Success:
- Status code: 200
- Content-Type: application/json
- Body example:
[ { "name": "Game 1", "release date": "01/01/1971", "genres": ["genre 1", "genre 2"], "platforms": ["platfrom 1", "platform 2", "platform 3"], "rating": 80.0, "description": "Description of the game" } ]
-
Errors:
- 400
-
GET /covida/games/{gamename}
-
Request:
- URL example:
http://localhost:8000/covida/games/Game1
- Path parameters:
- gamename - the name of the game to search for
- Body: None
- URL example:
-
Response:
-
Success:
- Status code: 200
- Content-Type: application/json
- Body example:
["Game1: edition X", "Game1: edition Y"]
-
Errors:
- 400
-
PUT /covida/groups
-
Request:
- URL example:
http://localhost:8000/covida/groups
- Path parameters: None
- Content-Type: application/json
- Body example:
{ "name": "G13", "description": "Description of G13" }
- URL example:
-
Response:
-
Success:
- Status code: 201
- Content-Type: application/json
- Body example:
{ "message": "Group with name G13 created.", "uri": "/covida/groups/G13 }
-
Errors:
- 400
-
PUT /covida/groups/{groupname}
-
Request:
- URL example:
http://localhost:8000/covida/groups/G13
- Path parameters:
- groupname - the name of the group to update
- Body example:
{ "name": "G15", "description": "Description of G15" }
- URL example:
-
Response:
-
Success:
- Status code: 200
- Content-Type: application/json
- Body example:
{ "message": "Group with name G13 updated", "uri": "/covida/groups/G15 }
-
Errors:
- 400 or 404
-
GET /covida/groups
-
Request:
- URL:
http://localhost:8000/covida/groups
- Path parameters: None
- Body: None
- URL:
-
Response:
-
Success:
- Status code: 200
- Content-Type: application/json
- Body example:
[ { "name": "G13", "description": "Description of G13", "games": ["Game 1", "Game 2", "Game 3"] }, { "name": "G15", "description": "Description of G15", "games": ["Game 1"] } ]
-
GET /covida/groups/{groupname}
-
Request:
- URL example:
http://localhost:8000/covida/groups/G13
- Path parameters:
- groupname - the name of the group to get the details
- Body: None
- URL example:
-
Response:
-
Success:
- Status code: 200
- Content-Type: application/json
- Body example:
[ { "name": "G13", "description": "Description of G13", "games": ["Game 1", "Game 2", "Game 3"] } ]
-
Errors:
- 404
-
POST /covida/groups/{groupname}/games
-
Request:
- URL example:
http://localhost:8000/covida/groups/G13/games
- Path parameters:
- groupname - the name of the group to add the game
- Content-Type: application/json
- Body example:
{ "name": "Game 1" } ```
- URL example:
-
Response:
-
Success:
- Status code: 200
- Content-Type: application/json
- Body example:
{ "message": "Game named Game 1 added to group G13", "uri": "/covida/groups/G13" }
-
Erros:
- 400 or 404
-
DELETE /covida/groups/{groupname}/games/{gamename}
-
Request:
- URL example:
http://localhost:8000/covida/groups/G13/games/Game1
- Path parameters:
- groupname - the name of the group to delete the game
- gamename - the name of the game to delete
- Body: None
- URL example:
-
Response:
-
Success:
- Status code: 200
- Content-Type: application/json
- Body example:
{ "message": "Game named Game1 deleted from group G13", "uri": "/covida/groups/G13/" }
-
Erros:
- 400 or 404
-
GET /covida/groups/{groupname}/ratedgames
-
Request:
- URL example:
http://localhost:8000/covida/groups/G13/ratedgames
- Path parameters: None
- Query string:
- min - the minimum rating value
- max - the maximum rating value
- Body: None
- URL example:
-
Response :
-
Success:
- Status code: 200
- Content-Type: application/json
- Body example:
["Game 1", "Game 2", "Game 3"]
-
Errors:
- 400 or 404
-
TODO