API Documentation

All available endpoints for the SavePoint REST API.

GET HEAD /api/games

Returns 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/:idOrSlug

Returns 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/genres

Returns a list of all game genres present in the dataset.

Returns: 200 - { genres: [ string ] }

Example:

GET /api/genres
GET HEAD /api/platforms

Returns a list of all game platforms present in the dataset.

Returns: 200 - { platforms: [ string ] }

Example:

GET /api/platforms
POST /api/games

Creates 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/:idOrSlug

Updates 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." }