Skip to content
Gabriel Sousa edited this page Nov 22, 2020 · 23 revisions

Chelas Open VIDeogame Application (COVIDA)

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 most popular games

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
  • 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

Search game by name

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
  • Response:

    • Success:

      • Status code: 200
      • Content-Type: application/json
      • Body example:
      ["Game1: edition X", "Game1: edition Y"]
    • Errors:

      • 400

Create a group

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"
    }
  • Response:

    • Success:

      • Status code: 201
      • Content-Type: application/json
      • Body example:
      {
          "message": "Group with name G13 created.",
          "uri": "/covida/groups/G13
      }
    • Errors:

      • 400

Update a group

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"
    }
  • 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 all groups

GET /covida/groups
  • Request:

    • URL: http://localhost:8000/covida/groups
    • Path parameters: None
    • Body: None
  • 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 the details of a group

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
  • 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

Add a game to a group

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"
    }
    ```
    
  • 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 a game from a group

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
  • 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 games from group which have a average rating between some range

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
  • Response :

    • Success:

      • Status code: 200
      • Content-Type: application/json
      • Body example:
      ["Game 1", "Game 2", "Game 3"]
    • Errors:

      • 400 or 404

Error Treatment

TODO