The idea of GéoQuizz API comes from a school project in which the objective is to feed a game where users could select a specific place to then get photos of important sites of it and locate them on a map. This API is created mainly for this reason, however, the structure of it can be used as a basis for future projects.
GéoQuizz API is a RESTful API for the consumption of the game of the same name, made mainly in PHP using the Laravel framework in its version 5.8. The structure of the GeoQuizz API database is MySQL, in the section of each table you can see the information concerning it as well as its fields.
At the moment the project is hosted on the Heroku server, in the future will be launched on a server of its own. The basic structure of the url is:
https://geoquizz-api.herokuapp.com/api/v1/:endpoint
Endpoint to register a new user
-
POST
-
-
...
-
...
-
-
-
name
email
password
password_confirmation
-
...
-
-
-
...
-
...
-
-
-
{ "success": true, "type": "resource", "message": "Registration completed successfully", "data": { "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSU..." } }
-
-
-
{ "success": false, "type": "error", "status": 400, "message": "There was an error!", "errors": { "name": [ "The name may not be greater than 255 characters.", "The name field is required." ], "email": [ "The email may not be greater than 255 characters.", "The email has already been taken.", "The email must be a valid email address.", "The email field is required." ], "password": [ "The password must be at least 8 characters.", "The password confirmation does not match.", "The password field is required." ] } }
-
Endpoint to log in to the system
-
POST
-
-
...
-
...
-
-
-
email
password
-
...
-
-
-
...
-
...
-
-
-
{ "success": true, "type": "resource", "message": "Logged successfully", "data": { "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSU..." } }
-
-
-
{ "success": false, "type": "error", "status": 422, "message": "User does not exist" }
-
{ "success": false, "type": "error", "status": 422, "message": "Password missmatch" }
-
Endpoint to log out of the system
-
GET
-
-
...
-
...
-
-
-
...
-
...
-
-
-
Authorization
:Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJS... (login's token)
-
...
-
-
-
{ "success": true, "type": "resource", "message": "You have been successfully logged out!", "data": "" }
-
-
-
{ "success": false, "type": "error", "status": 401, "message": "Unauthenticated. You need to be logged to make this action" }
-
Endpoint to get information from the logged-in user
-
GET
-
-
...
-
...
-
-
-
...
-
...
-
-
-
Authorization
:Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJS... (login's token)
-
...
-
-
-
{ "success": true, "type": "resource", "message": "User obtained", "data": { "id": 12, "name": "Admin", "email": "admin@mail.com", "email_verified_at": null, "created_at": "2019-05-20 05:17:22", "updated_at": "2019-05-20 05:17:22" } }
-
-
-
{ "success": false, "type": "error", "status": 401, "message": "Unauthenticated. You need to be logged to make this action" }
-
Field | Type | Description |
---|---|---|
id | integer | Game identifier |
player | string | Name of the player |
status | integer | Game status 0 = completed 1 = started 2 = completed but not visible in scoreboard |
score | integer | Game score |
idSeries | integer | Identifier of the series to which it belongs |
idDifficulty | integer | Identifier of the difficulty to which it belongs |
-
GET
Endpoint for a list of games registered in the databasePOST
Endpoint to register a new game in the database -
-
...
-
- Used to specify the page number you want to access.
- Used to specify the maximum number of elements on a page of the answer.
- Used to specify the fields to get from the list items, it will give one of them separated by a comma.
- Used to specify a field by which to sort items in the list.
- Used to specify a direction by which to sort items in the list.
-
Used to get a list filtered by a field giving a specific value. These are separated by a colon. e.g. =
field:operator:value
. Available operators:=, !=, <, <=, >, >=
-
-
-
player
idSeries
idDifficulty
-
status
score
-
-
-
...
-
...
-
-
-
{ "success": true, "type": "resource", "message": "Game created successfully.", "data": { "id": 51, "status": 2, "score": 1000, "player": "NebruEdnco", "idSeries": 1, "idDifficulty": 1, "created_at": "2019-05-20 07:33:44", "updated_at": "2019-05-20 07:33:44" } }
-
{ "success": true, "type": "collection", "message": "Games retrieved successfully.", "data": { "count": 25, "games": [ { "game": { "id": 1, "player": "Raegan Carter" }, "links": { "self": { "href": "https://geoquizz-api.herokuapp.com/api/v1/games/1" } } }, { "...": "..." } ], "links": { "prev": { "href": "https://geoquizz-api.herokuapp.com/api/v1/games?page=1" }, "next": { "href": "https://geoquizz-api.herokuapp.com/api/v1/games?page=2" }, "first": { "href": "https://geoquizz-api.herokuapp.com/api/v1/games?page=1" }, "last": { "href": "https://geoquizz-api.herokuapp.com/api/v1/games?page=3" } } } }
-
-
-
{ "success": false, "type": "error", "status": 400, "message": "There was an error with the fields.", "errors": { "status": [ "The status must be a number.", "The status must be between 0 and 2." ], "score": ["The score must be a number."], "player": ["The player field is required."], "idSeries": [ "The id series must be a number.", "The id series field is required.", "The selected id series is invalid." ], "idDifficulty": [ "The id difficulty must be a number.", "The id difficulty field is required.", "The selected id difficulty is invalid." ] } }
-
-
GET
Endpoint to get information about a specific gamePUT
Endpoint to update the information of a specific gameDELETE
Endpoint to remove a specific game -
-
...
-
...
-
-
-
...
-
status
score
player
idSeries
idDifficulty
-
-
-
-
DELETE
Authorization
:Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJS... (login's token)
-
-
...
-
-
-
{ "success": true, "type": "resource", "message": "Game retrieved successfully.", "data": { "game": { "id": 25, "status": 1, "score": 272581, "player": "Dahlia Williamson", "idSeries": 38, "idDifficulty": 17, "created_at": "2019-05-05 09:09:38", "updated_at": "2019-05-05 09:09:38", "series": [ { "series": { "id": 38, "city": "North Madilyn" }, "links": { "href": "https://geoquizz-api.herokuapp.com/api/v1/series/38" } } ], "difficulties": [ { "difficulty": { "id": 17, "name": "Kamille Greenfelder" }, "links": { "href": "https://geoquizz-api.herokuapp.com/api/v1/series/17" } } ], "links": { "self": { "href": "https://geoquizz-api.herokuapp.com/api/v1/games/25" } } } } }
-
{ "success": true, "type": "resource", "message": "Game updated successfully.", "data": { "id": 25, "status": "2", "score": "9999", "player": "NebruEdnco", "idSeries": "1", "idDifficulty": "1", "created_at": "2019-05-05 09:09:38", "updated_at": "2019-05-20 13:39:45" } }
-
-
-
-
{ "success": false, "type": "error", "status": 400, "message": "There was an error with the fields.", "errors": { "status": [ "The status must be a number.", "The status must be between 0 and 2." ], "score": ["The score must be a number."], "player": ["The player field must have a value."], "idSeries": [ "The id series must be a number.", "The selected id series is invalid." ], "idDifficulty": [ "The id difficulty must be a number.", "The selected id difficulty is invalid." ] } }
-
{ "success": false, "type": "error", "status": 401, "message": "Unauthenticated. You need to be logged to make this action" }
-
{ "success": false, "type": "error", "status": 404, "message": "Information not found for: https://geoquizz-api.herokuapp.com/api/v1/games/50" }
-
Field | Type | Description |
---|---|---|
id | integer | Difficulty identifier |
name | string | Name of the difficulty |
distance | float | Distance of between the place and the user position |
numberOfPhotos | integer | Quantity of photos to show |
-
GET
Endpoint for a list of difficulties registered in the databasePOST
Endpoint to register a new difficulty in the database -
-
...
-
- Used to specify the page number you want to access.
- Used to specify the maximum number of elements on a page of the answer.
- Used to specify the fields to get from the list items, it will give one of them separated by a comma.
- Used to specify a field by which to sort items in the list.
- Used to specify a direction by which to sort items in the list.
-
Used to get a list filtered by a field giving a specific value. These are separated by a colon. e.g. =
field:operator:value
. Available operators:=, !=, <, <=, >, >=
-
-
-
name
distance
numberOfPhotos
-
...
-
-
-
-
POST
Authorization
:Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJS... (login's token)
-
-
...
-
-
-
{ "success": true, "type": "resource", "message": "Difficulty created successfully.", "data": { "id": 51, "name": "Hard", "distance": 1000, "numberOfPhotos": 10, "created_at": "2019-05-21 06:04:18", "updated_at": "2019-05-21 06:04:18" } }
-
{ "success": true, "type": "collection", "message": "Difficulties retrieved successfully.", "data": { "count": 25, "difficulties": [ { "difficulty": { "id": 1, "name": "Roscoe Rempel" }, "links": { "self": { "href": "https://geoquizz-api.herokuapp.com/api/v1/difficulties/1" } } }, { "...": "..." } ], "links": { "prev": { "href": "https://geoquizz-api.herokuapp.com/api/v1/difficulties?page=1" }, "next": { "href": "https://geoquizz-api.herokuapp.com/api/v1/difficulties?page=2" }, "first": { "href": "https://geoquizz-api.herokuapp.com/api/v1/difficulties?page=1" }, "last": { "href": "https://geoquizz-api.herokuapp.com/api/v1/difficulties?page=2" } } } }
-
-
-
{ "success": false, "type": "error", "status": 400, "message": "There was an error with the fields.", "errors": { "name": ["The name field is required."], "distance": [ "The distance field is required.", "The distance must be a number." ], "numberOfPhotos": [ "The number of photos field is required.", "The number of photos must be a number." ] } }
-
{ "success": false, "type": "error", "status": 401, "message": "Unauthenticated. You need to be logged to make this action" }
-
-
GET
Endpoint to get information about a specific difficultyPUT
Endpoint to update the information of a specific difficultyDELETE
Endpoint to remove a specific difficulty -
-
...
-
...
-
-
-
...
-
name
distance
numberOfPhotos
-
-
-
-
DELETE | PUT
Authorization
:Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJS... (login's token)
-
-
...
-
-
-
{ "success": true, "type": "resource", "message": "Difficulty retrieved successfully.", "data": { "difficulty": { "id": 25, "name": "Nya Carter", "distance": 123, "numberOfPhotos": 81, "created_at": "2019-05-05 09:09:37", "updated_at": "2019-05-05 09:09:37", "games": [ { "game": { "id": 29, "player": "Delphia Skiles DDS" }, "href": "https://geoquizz-api.herokuapp.com/api/v1/games/29" } ], "links": { "self": { "href": "https://geoquizz-api.herokuapp.com/api/v1/difficulties/25" } } } } }
-
{ "success": true, "type": "resource", "message": "Difficulty updated successfully.", "data": { "id": 25, "name": "SuperHard", "distance": "10", "numberOfPhotos": "5", "created_at": "2019-05-05 09:09:37", "updated_at": "2019-05-21 06:10:08" } }
-
-
-
-
{ "success": false, "type": "error", "status": 400, "message": "There was an error with the fields.", "errors": { "name": ["The name field must have a value."], "distance": ["The distance must be a number."], "numberOfPhotos": ["The number of photos must be a number."] } }
-
{ "success": false, "type": "error", "status": 401, "message": "Unauthenticated. You need to be logged to make this action" }
-
{ "success": false, "type": "error", "status": 404, "message": "Information not found for: https://geoquizz-api.herokuapp.com/api/v1/difficulties/50" }
-
Field | Type | Description |
---|---|---|
id | integer | Series identifier |
city | string | Name of the city were the series belong |
latitude | float | Latitude geographic of the city |
longitude | float | Longitude geographic of the city |
zoom | integer | Zoom of the map (usually a parameter of maps) |
-
GET
Endpoint for a list of the series registered in the databasePOST
Endpoint to register a new series in the database -
-
...
-
- Used to specify the page number you want to access.
- Used to specify the maximum number of elements on a page of the answer.
- Used to specify the fields to get from the list items, it will give one of them separated by a comma.
- Used to specify a field by which to sort items in the list.
- Used to specify a direction by which to sort items in the list.
-
Used to get a list filtered by a field giving a specific value. These are separated by a colon. e.g. =
field:operator:value
. Available operators:=, !=, <, <=, >, >=
-
-
-
city
latitude
longitude
zoom
-
...
-
-
-
-
POST
Authorization
:Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJS... (login's token)
-
-
...
-
-
-
{ "success": true, "type": "resource", "message": "Series created successfully.", "data": { "id": 51, "city": "New York", "latitude": 13.21816, "longitude": -26.15646, "zoom": 15, "created_at": "2019-05-21 07:07:22", "updated_at": "2019-05-21 07:07:22" } }
-
{ "success": true, "type": "collection", "message": "Series retrieved successfully.", "data": { "count": 25, "series": [ { "series": { "id": 1, "city": "New Nellaside" }, "links": { "self": { "href": "https://geoquizz-api.herokuapp.com/api/v1/series/1" } } }, { "...": "..." } ], "links": { "prev": { "href": "https://geoquizz-api.herokuapp.com/api/v1/series?page=1" }, "next": { "href": "https://geoquizz-api.herokuapp.com/api/v1/series?page=2" }, "first": { "href": "https://geoquizz-api.herokuapp.com/api/v1/series?page=1" }, "last": { "href": "https://geoquizz-api.herokuapp.com/api/v1/series?page=2" } } } }
-
-
-
{ "success": false, "type": "error", "status": 400, "message": "There was an error with the fields.", "errors": { "city": ["The city field is required."], "latitude": ["The latitude field is required."], "longitude": ["The longitude field is required."], "zoom": ["The zoom field is required."] } }
-
{ "success": false, "type": "error", "status": 401, "message": "Unauthenticated. You need to be logged to make this action" }
-
-
GET
Endpoint to get information about a specific seriesPUT
Endpoint to update the information of a specific seriesDELETE
Endpoint to remove a specific series -
-
...
-
...
-
-
-
...
-
city
latitude
longitde
zoom
-
-
-
-
DELETE | PUT
Authorization
:Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJS... (login's token)
-
-
...
-
-
-
{ "success": true, "type": "resource", "message": "Series retrieved successfully.", "data": { "series": { "id": 10, "city": "North Pierreport", "latitude": 27.520578, "longitude": -83.844109, "zoom": 30, "created_at": "2019-05-05 09:09:37", "updated_at": "2019-05-05 09:09:37", "games": [ { "game": { "id": 14, "player": "Prof. Gerald Ondricka PhD" }, "links": { "href": "https://geoquizz-api.herokuapp.com/api/v1/games/14" } } ], "photos": [ { "photo": { "id": 10, "description": "Voluptate eum velit rerum enim doloribus tenetur et. Dicta dolore sint nulla ex doloremque. Pariatur ut eligendi velit ratione vitae sapiente. Vel atque quod vitae placeat. Maxime voluptas est asperiores inventore molestiae." }, "links": { "href": "https://geoquizz-api.herokuapp.com/api/v1/photos/10" } } ], "links": { "self": { "href": "https://geoquizz-api.herokuapp.com/api/v1/series/10" } } } } }
-
{ "success": true, "type": "resource", "message": "Series updated successfully.", "data": { "id": 10, "city": "New Jersey", "latitude": "26.15612", "longitude": "86.1861", "zoom": "15", "created_at": "2019-05-05 09:09:37", "updated_at": "2019-05-21 07:12:07" } }
-
-
-
-
{ "success": false, "type": "error", "status": 400, "message": "There was an error with the fields.", "errors": { "city": ["The city field must have a value."], "latitude": ["The latitude must be a number."], "longitude": ["The longitude must be a number."], "zoom": ["The zoom must be a number."] } }
-
{ "success": false, "type": "error", "status": 401, "message": "Unauthenticated. You need to be logged to make this action" }
-
{ "success": false, "type": "error", "status": 404, "message": "Information not found for: https://geoquizz-api.herokuapp.com/api/v1/series/50" }
-
Field | Type | Description |
---|---|---|
id | integer | Photo identifier |
description | string | Description of the image |
latitude | float | Latitude geographic of the city |
longitude | float | Longitude geographic of the city |
url | string | Url of the image |
idSeries | integer | Zoom of the map (usually a parameter of maps) |
-
GET
Endpoint for a list of photos registered in the databasePOST
Endpoint to register a new photo in the database -
-
...
-
- Used to specify the page number you want to access.
- Used to specify the maximum number of elements on a page of the answer.
- Used to specify the fields to get from the list items, it will give one of them separated by a comma.
- Used to specify a field by which to sort items in the list.
- Used to specify a direction by which to sort items in the list.
-
Used to get a list filtered by a field giving a specific value. These are separated by a colon. e.g. =
field:operator:value
. Available operators:=, !=, <, <=, >, >=
-
-
-
description
latitude
longitude
zoom
-
idSeries
-
-
-
-
POST
Authorization
:Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJS... (login's token)
-
-
...
-
-
-
{ "success": true, "type": "resource", "message": "Photo created successfully.", "data": { "id": 51, "description": "A good place", "latitude": 15.6156165, "longitude": 20.6548664, "url": "https://www.imagehost.com/ad654da56s4", "idSeries": 20, "created_at": "2019-05-21 07:25:13", "updated_at": "2019-05-21 07:25:13" } }
-
{ "success": true, "type": "collection", "message": "Photos retrieved successfully.", "data": { "count": 25, "photos": [ { "photo": { "id": 1, "description": "Incidunt optio assumenda aperiam. Id sit minus illum. Repellendus molestiae dicta dignissimos doloremque quibusdam eius fuga. Repudiandae laboriosam nihil est." }, "links": { "self": { "href": "https://geoquizz-api.herokuapp.com/api/v1/photos/1" } } }, { "...": "..." } ], "links": { "prev": { "href": "https://geoquizz-api.herokuapp.com/api/v1/photos?page=1" }, "next": { "href": "https://geoquizz-api.herokuapp.com/api/v1/photos?page=2" }, "first": { "href": "https://geoquizz-api.herokuapp.com/api/v1/photos?page=1" }, "last": { "href": "https://geoquizz-api.herokuapp.com/api/v1/photos?page=3" } } } }
-
-
-
{ "success": false, "type": "error", "status": 400, "message": "There was an error with the fields.", "errors": { "description": ["The description field is required."], "idSeries": [ "The id series must be a number.", "The selected id series is invalid." ], "latitude": [ "The latitude field is required.", "The latitude must be a number." ], "longitude": [ "The longitude field is required.", "The longitude must be a number." ], "url": [ "The url field is required.", "The url format is invalid." ] } }
-
{ "success": false, "type": "error", "status": 401, "message": "Unauthenticated. You need to be logged to make this action" }
-
-
GET
Endpoint to get information about a specific photoPUT
Endpoint to update the information of a specific photoDELETE
Endpoint to remove a specific photo -
-
...
-
...
-
-
-
...
-
description
latitude
longitde
url
idSeries
-
-
-
-
DELETE | PUT
Authorization
:Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJS... (login's token)
-
-
...
-
-
-
{ "success": true, "type": "resource", "message": "Photo retrieved successfully.", "data": { "photo": { "id": 25, "description": "Deserunt ullam ut quo consequatur. Voluptatem non qui voluptatem nihil eos pariatur adipisci. Voluptatum dolor excepturi dolor ut dolorum. Sint sit perferendis animi sint consequatur officia.", "latitude": 55.871643, "longitude": 169.674947, "url": "https://nicolas.com/beatae-molestiae-at-necessitatibus-dicta-veritatis-reiciendis-quis-et.html", "idSeries": 29, "created_at": "2019-05-05 09:09:38", "updated_at": "2019-05-05 09:09:38", "series": [ { "series": { "id": 29, "city": "Bethelberg" }, "links": { "href": "https://geoquizz-api.herokuapp.com/api/v1/series/29" } } ], "links": { "self": { "href": "https://geoquizz-api.herokuapp.com/api/v1/photos/25" } } } } }
-
{ "success": true, "type": "resource", "message": "Photo updated successfully.", "data": { "id": 25, "description": "A good place", "latitude": "18.00001", "longitude": "19.00002", "url": "https://www.imageonline.net/image/5a65sd5", "idSeries": "50", "created_at": "2019-05-05 09:09:38", "updated_at": "2019-05-21 07:31:25" } }
-
-
-
-
{ "success": false, "type": "error", "status": 400, "message": "There was an error with the fields.", "errors": { "description": ["The description field must have a value."], "idSeries": [ "The id series must be a number.", "The selected id series is invalid." ], "latitude": ["The latitude must be a number."], "longitude": ["The longitude must be a number."], "url": ["The url format is invalid."] } }
-
{ "success": false, "type": "error", "status": 401, "message": "Unauthenticated. You need to be logged to make this action" }
-
{ "success": false, "type": "error", "status": 404, "message": "Information not found for: https://geoquizz-api.herokuapp.com/api/v1/photos/50" }
-
All information shown in this documentation is fictitious and is used only as a demonstration of API results.