https://guidr-api.herokuapp.com
No headers needed
Method Url: /guidr/guides/all
HTTP method: [GET]
If you successfully fetch the guides, the endpoint will return an HTTP response with a status code
200
and a array of objects as below.
{
"id": 1,
"name": "Stephannie Joskowitz",
"tagline": "Aliquam nec pellentesque erat. Nam tristique et tellus quis rutrum. Suspendisse potenti. Mauris arcu neque, feugiat eu ex eu, dapibus dignissim augue. Integer nec augue velit. Donec sit amet neque cursus, tempus turpis vel, sodales libero.",
"age": 34,
"title": "Expert Guide",
"careerLength": "3 years"
}
Method Url: /guidr/guides/:guideId
HTTP method: [GET]
If you successfully fetch the guide, the endpoint will return an HTTP response with a status code
200
and an object as below.
{
"id": 1,
"name": "Stephannie Joskowitz",
"tagline": "Aliquam nec pellentesque erat. Nam tristique et tellus quis rutrum. Suspendisse potenti. Mauris arcu neque, feugiat eu ex eu, dapibus dignissim augue. Integer nec augue velit. Donec sit amet neque cursus, tempus turpis vel, sodales libero.",
"age": 34,
"title": "Expert Guide",
"careerLength": "3 years"
}
If you send in an invalid guideId, the endpoint will return an HTTP response with a status code
404
and a body as below.
{
"error": "That user does not exist"
}
Method Url: /guidr/trips/all
HTTP method: [GET]
If you successfully fetch the guides, the endpoint will return an HTTP response with a status code
200
and a array of objects as below.
{
"id": 2,
"title": "Horse Rebellion",
"description": "Tough Russian Mountain Escape",
"designation": "Professional",
"type": "Valuyki",
"duration": "2 days",
"guide_id": 6,
"img_url": "https://images.pexels.com/photos/1840102/pexels-photo-1840102.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940",
"created_at": "2019-02-05T17:59:09.590Z",
"updated_at": "2019-02-05T17:59:09.590Z"
}
Method Url: /guidr/trips/:tripId
HTTP method: [GET]
If you successfully fetch the trip, the endpoint will return an HTTP response with a status code
200
and an object as below.
{
"id": 2,
"title": "Horse Rebellion",
"description": "Tough Russian Mountain Escape",
"designation": "Professional",
"type": "Valuyki",
"duration": "2 days",
"guide_id": 6,
"img_url": "https://images.pexels.com/photos/1840102/pexels-photo-1840102.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940",
"created_at": "2019-02-05T17:59:09.590Z",
"updated_at": "2019-02-05T17:59:09.590Z"
}
If you send in an invalid tripId, the endpoint will return an HTTP response with a status code
404
and a body as below.
{
"error": "That user does not exist"
}
name | type | required | description |
---|---|---|---|
Authorization |
String | Yes | Bearer JWT authorization token |
Method Url: /user/guides/:guideId
HTTP method: [GET]
If you successfully fetch the user, the endpoint will return an HTTP response with a status code
200
and a body as below.
{
"id": 1,
"username": "sjoskowitz0",
"password": "$2a$14$0db0iQaspO6hIHtFq6Lj1.jAwXpMWSuF37s7eQ5uWNvl8eO4DzgXi",
"name": "Stephannie Joskowitz",
"age": 29,
"title": "Expert Guide",
"tagline": "I'm the best guide this side of the Mississippi",
"careerLength": "12 years"
}
If you send in invalid fields or the password of the user corresponding to the token does not match the currentPassword field, the endpoint will return an HTTP response with a status code
400
and a body as below.
{
"error": "That user does not exist"
}
Method Url: /user/guides/update/:guideId
HTTP method: [PUT]
name | type | required | description |
---|---|---|---|
name |
String | No | Guide's name (unique) |
age |
Int | No | Age of guide |
tagline |
String | No | Short description of guide |
title |
String | No | Job title |
careerLength |
String | No | Amount of time as guide |
example:
{
"tagline": "I'm the best guide this side of the Mississippi",
"careerLength": "12 years",
"age": 29
}
If you successfully update the user, the endpoint will return an HTTP response with a status code
200
and a body as below.
1
If you send in invalid fields, the endpoint will return an HTTP response with a status code
500
and a body as below.
{
"name": "error",
"length": 128,
"severity": "ERROR",
"code": "42703",
"position": "70",
"file": "analyze.c",
"line": "2339",
"routine": "transformUpdateTargetList"
}
If you send in an invalid guideId, the endpoint will return an HTTP response with a status code
400
and a body as below.
{
"error": "A user with that ID does not exist"
}
Method Url: /user/trips/all
HTTP method: [GET]
If you successfully fetch the user, the endpoint will return an HTTP response with a status code
200
and a an array of objects as below.
{
[
{
"id": 5,
"title": "Boy A",
"description": "Sweden",
"img_url": "http://dummyimage.com/212x139.png/5fa2dd/ffffff"
},
{
"id": 8,
"title": "Hotel",
"description": "Ecuador",
"img_url": "https://images.pexels.com/photos/1840102/pexels-photo-1840102.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940"
},
{
"id": 11,
"title": "Wavelength",
"description": "Indonesia",
"img_url": "http://dummyimage.com/195x202.png/dddddd/000000"
}
]
}
If you supply an invalid guideId or the guide has no trips, the endpoint will return an HTTP response with a status code
404
and a body as below.
{
"error": "There are no trips for this guideId"
}
Method Url: /user/trips/:tripId
HTTP method: [GET]
If you successfully fetch the user, the endpoint will return an HTTP response with a status code
200
and a an array of objects as below.
{
"id": 5,
"title": "Boy A",
"description": "Sweden",
"designation": "Professional",
"type": "Skellefteå",
"duration": "4 days",
"guide_id": 1,
"img_url": "http://dummyimage.com/212x139.png/5fa2dd/ffffff"
}
If you supply an invalid tripId, the endpoint will return an HTTP response with a status code
404
and a body as below.
{
"error": "A trip with that ID does not exist for the specified user"
}
Method Url: /user/trips/:tripId
HTTP method: [PUT]
name | type | required | description |
---|---|---|---|
title |
String | No | Guide's name |
description |
String | No | Age of guide |
designation |
String | No | Professional or Private |
type |
String | No | Category of trip |
duration |
String | No | Trip duration |
img_url |
String | No | Image related to trip |
example:
{
"title": "Norwegian Polar Trek",
"description": "Go north to find the beauty and harsh reality of the frozen tundra inside the Arctic Circle in Norway",
"duration": "14 days",
"type": "Cross-country skiing, winter backpacking/camping"
}
If you successfully update the user, the endpoint will return an HTTP response with a status code
200
and a an array of objects as below.
1
If you supply an invalid tripId, the endpoint will return an HTTP response with a status code
404
and a body as below.
{
"error": "A trip/user with that ID does not exist"
}
If you supply a valid tripId but it's not related to the logged in user, the endpoint will return an HTTP response with a status code
400
and a body as below.
{
"error": "You must be the trip's guide to make changes to this trip"
}
Method Url: /user/trips/create
HTTP method: [POST]
name | type | required | description |
---|---|---|---|
title |
String | Yes | Trip's name (unique) |
description |
String | Yes | Age of guide |
type |
String | Yes | Category of trip |
duration |
String | Yes | Trip duration |
designation |
String | No | Professional or Private |
img_url |
String | No | Image related to trip |
example:
{
"title": "Norwegian Polar Trek",
"description": "Go north to find the beauty and harsh reality of the frozen tundra inside the Arctic Circle in Norway",
"duration": "14 days",
"type": "Cross-country skiing, winter backpacking/camping",
"img_url": "www.fakeimage.com/fakeimage1"
}
If you successfully create the trip, the endpoint will return an HTTP response with a status code
201
and the id of the newly created trip as below.
{
11
}
Method Url: /user/trips/:tripId/upload
HTTP method: [POST]
name | type | required | description |
---|---|---|---|
url |
String | Yes | Image url |
example:
{
"url": "https://images.pexels.com/photos/556416/pexels-photo-556416.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940"
}
If you successfully create the trip, the endpoint will return an HTTP response with a status code
201
and the id of the newly added image as below.
{
11
}
If you supply an invalid tripId, the endpoint will return an HTTP response with a status code
404
and a body as below.
{
"error": "A trip with that id does not exist"
}
Method Url: /user/trips/:id
HTTP method: [DELETE]
If you successfully delete the trip, the endpoint will return an HTTP response with a status code
202
and a body as below.
1
If you send an invalid tripId, the endpoint will return an HTTP response with a status code
400
and a body as below.
{
"error": "A trip with that ID does not exist"
}
Method Url: /auth/register
HTTP method: [POST]
name | type | required | description |
---|---|---|---|
username |
String | Yes | username (unique) |
password |
String | Yes | password |
name |
String | Yes | Guide's name (unique) |
age |
Int | No | Age of guide |
tagline |
String | No | Short description of guide |
title |
String | No | Job title |
careerLength |
String | No | Amount of time as guide |
example:
{
"username": "deploy_test",
"password": "newuser",
"name": "Mr. Deploy User"
}
If you successfully delete the trip, the endpoint will return an HTTP response with a status code
201
and a body as below.
{
"id": 50,
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InJlYWRtZSIsImlhdCI6MTU0OTMyMjk5NSwiZXhwIjoxNTQ5NDA5Mzk1LCJqdGkiOiJndWlkciJ9.YXnh9zGn-TNkfGQ68xCQWJCzLOaYwTx32vEllP4Qtmw",
}
If body is missing either password, username or name, the endpoint will return an HTTP response with a status code
404
and a body as below.
{
"error": "Please include name, username and password in request"
}
Method Url: /auth/login
HTTP method: [POST]
name | type | required | description |
---|---|---|---|
username |
String | Yes | username (unique) |
password |
String | Yes | password |
example:
{
"username": "test",
"password": "brap"
}
If you successfully login, the endpoint will return an HTTP response with a status code
200
and a body as below.
{
"id": 1,
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InNqb3Nrb3dpdHowIiwiaWF0IjoxNTQ5MzIyOTAwLCJleHAiOjE1NDk0MDkzMDAsImp0aSI6Imd1aWRyIn0.tEgYfk6yB7r2hCQyE0sPD84Adri8VoGQVKWRR7rBggM"
}
If you send incorrect credentials, the endpoint will return an HTTP response with a status code
404
and a body as below.
{
"err": "A user with those credentials does not exist"
}