Public
Documentation Settings

Natours-API

RESTful API for a fictional tour booking company Natours

Features:

  • Multiple Resources : Tours, Users , Reviews , Bookings
  • CRUD Operations implemented with protected routes
  • JWT based authentication system
  • Database used : MongoDB with custom schema

Tours

Requests related to the Tours Resource

GETGet All Tours

127.0.0.1:3000/api/v1/tours
AUTHORIZATIONBearer Token
Token
Example Request
curl
curl --location '127.0.0.1:3000/api/v1/tours'
Example Response
No response body
This request doesn't return any response body
No response headers
This request doesn't return any response headers

GETGet Tour

127.0.0.1:3000/api/v1/tours/5c88fa8cf4afda39709c2961
Example Request
curl
curl --location '127.0.0.1:3000/api/v1/tours/5c88fa8cf4afda39709c2961'
Example Response
No response body
This request doesn't return any response body
No response headers
This request doesn't return any response headers

POSTCreate New Tour

127.0.0.1:3000/api/v1/tours
Bodyraw (json)
json
{
    "name" : "Super tour to be deleted II",
    "duration" : 1,
    "maxGroupSize" : 1,
    "difficulty" : "easy",
    "priceDiscount" : 400,
    "price": 500,
    "summary" : "Tst tour",
    "description" : "test tours",
    "imageCover" : "test.jpg",
    "startDates" : [
      "2021-06-19T04:30:00.000Z",
      "2021-07-20T04:30:00.000Z",
      "2021-08-18T04:30:00.000Z"
    ],
    "secretTour" : false,
    "rating": 4.8,
    "guides":[
      "629f853573d093a94d0e0a2b",
      "629f857773d093a94d0e0a2f"
    ]
}
Example Request
curl
curl --location '127.0.0.1:3000/api/v1/tours' \
--data '{
    "name" : "Super tour to be deleted II",
    "duration" : 1,
    "maxGroupSize" : 1,
    "difficulty" : "easy",
    "priceDiscount" : 400,
    "price": 500,
    "summary" : "Tst tour",
    "description" : "test tours",
    "imageCover" : "test.jpg",
    "startDates" : [
      "2021-06-19T04:30:00.000Z",
      "2021-07-20T04:30:00.000Z",
      "2021-08-18T04:30:00.000Z"
    ],
    "secretTour" : false,
    "rating": 4.8,
    "guides":[
      "629f853573d093a94d0e0a2b",
      "629f857773d093a94d0e0a2f"
    ]
}'
Example Response
No response body
This request doesn't return any response body
No response headers
This request doesn't return any response headers

PATCHUpdate Tour

127.0.0.1:3000/api/v1/tours/617ce413168dd66811d351d5
Bodyraw (json)
json
{
  "price": "same price"
}
Example Request
curl
curl --location --request PATCH '127.0.0.1:3000/api/v1/tours/617ce413168dd66811d351d5' \
--data '{
  "price": "same price"
}'
Example Response
No response body
This request doesn't return any response body
No response headers
This request doesn't return any response headers