GET HEAD /api/gamesReturns a list of all games in the database. All query params are optional and they can be combined.
Query Params: name, genre, platform (string,
case-insensitive), limit (number, restricts the results returned).
Returns: 200 -
{ games: [ { id, name, slug, cover, genres, platforms, rating, rating_count, first_release_date } ] }
Example:
GET /api/games?genre=RPG&limit=5
GET HEAD /api/games/:idOrSlugReturns a single game by its ID number or slug.
Path Param: idOrSlug - required, numeric ID or slug string.
Returns: 200 - full game object. 404 - game not found.
Example:
GET /api/games/halo 
GET /api/games/22439
GET HEAD /api/genresReturns a list of all game genres present in the dataset.
Returns: 200 - { genres: [ string ] }
Example:
GET /api/genres
GET HEAD /api/platformsReturns a list of all game platforms present in the dataset.
Returns: 200 - { platforms: [ string ] }
Example:
GET /api/platforms
POST /api/gamesCreates a new game entry in the database. The server generates the ID and slug automatically from the name.
Body Params: name (string, required), genres (string[],
optional), platforms (string[], optional), rating (number, optional),
summary (string, optional), storyline (string, optional),
cover (string, optional), url (string, optional),
first_release_date (number, optional).
Accepts: application/json or
application/x-www-form-urlencoded
Returns: 201 - the created game object. 400 - missing name
or slug conflict.
Example:
POST /api/games 
Content-Type: application/json

{ "name": "Halo" }
POST /api/games/:idOrSlugUpdates an existing game in the database. Only fields provided in the body are changed - all others will remain unchanged. The game's ID and slug cannot be changed.
Path Param: idOrSlug - required, numeric ID or slug string.
Body Params: Any combination of name, genres,
platforms, rating, summary, storyline,
cover, url, first_release_date - all optional.
Accepts: application/json or
application/x-www-form-urlencoded
Returns: 204 - no content, update successful. 404 - game
not found.
Example:
POST /api/games/halo
Content-Type: application/json

{ "summary": "A great shooter." }