Skip to content

gauravxor/indian-tourism-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Indian Tourism API Documentation

All the APIs uses JSON Web Tokens (JWT) for authentication, which are automatically stored as HTTP Cookies. No manual token handling is required.

User Authentication Endpoints

API Endpoint Method Auth Description
1. /api/auth/login POST NO Send a login request
2. /api/auth/signup POST NO Send a singup request
3. /api/auth/logout POST YES Logout the current user
4. /api/auth/forgot-password POST NO Reset the password

User Operation Endpoints

API Endpoint Method Auth Description
1. /api/update/user POST YES Update User Details
2. /api/user/details/{userId} GET YES Get user details
3. /api/user/bookings/{userId} GET YES Get user's bookings
4. /api/book/cancellations/{userId} GET YES Get user's cancellations

Location Endpoints

API Endpoint Method Auth Description
1. /api/location/add-location/ POST YES Add new location
2. /api/location/update-location/{locationId} GET YES Update location data
3. /api/location/ GET NO Get random locations
4. /api/location/search/kolkata GET NO Search for a locations
5. /api/location/get-availability/{locationId} GET NO Get Location's availablity data

Booking Endpoints

API Endpoint Method Auth Description
1. /api/book/lock/ POST YES Temporarily lock a booking
2. /api/book/lock/details/{lockId} GET YES Get booking lock details
3. /api/book/final POST YES Finalize the locked booking
4. /api/book/cancel POST YES Cancel a booking
5. /api/book/cancel/approve POST YES Approve a cancellation request

One Time Password (OTP) Endpoints

API Endpoint Method Auth Description
1. /api/auth/resend-otp POST YES Send email verification or password reset OTP
2. /api/auth/verify-otp POST * Resend email verification or password reset OTP

API Usage Instructions

Creating a login request

Send a POST request to the /api/auth/login endpoint.

POST http://example.com/api/auth/login
Content-Type: application/json

{
    "email": "email@domain.com",
    "password": "yourPassword"
}

Creating a signup request

Send a POST request to the /api/auth/signup endpoint.

POST http://example.com/api/auth/signup
Content-Type: application/json

{
    "email": "email@domain.com",
    "password": "yourPassword"
}

The request body should also contain the following information

middleName, email, phone, addressMain, country, state, city, pincode, dob with their values in string format.

Making a logout request

Send a POST request to the /api/auth/logout endpoint.

POST http://example.com/api/auth/logout
Content-Type: application/json

{
    "email": "email@domain.com",
}

Resetting the password

Send a POST request to the /api/auth/forgot-password endpoint.

POST http://example.com/api/auth/forgot-password
Content-Type: application/json

{
    "email": "email@domain.com",
}

Updating user details

Send a POST request to the /api/update/user endpoint.

POST http://example.com/api/update/user
Content-Type: multipart/form-data

{
    "firstName": "modified-first-name",
    "lastName" : "modified-last-name",
    "email": "email@domain.com",
}

The multipart form data can also contain the following fields middleName, email, phone, addressMain, country, state, city, pincode, dob in string format.

Fetching user details

Send a GET request to the /api/user/details/{userId} endpoint.

GET http://example.com/api/user/details/{userId}

Fetching all the locations booked by a user

Send a GET request to the /api/user/bookings/{userId} endpoint.

GET http://example.com/api/user/bookings/{userId}

Fetching all the bookings cancelled by a user

Send a GET request to the /api/user/cancellations/{userId} endpoint.

GET http://example.com/api/user/cancellations/{userId}

Request to add a new location

Send a POST request to the /api/location/add-location endpoint.

POST http://example.com/api/location/add-location
Content-Type: application/json

{
    "name" : "name-of-the-location"
    "description" : "description-of-the-location"
    "address" : "address-of-the-location"
}

The request body JSON should also contain all these fields. city, state, country, pincode, latitude, longitude, ticketPrice containing string data,

cover-iamge1, cover-iamge2, cover-iamge3, slider-image1, slider-image2 and slider-image3 containing image data.

Updating a location data

Send a POST request to the /api/location/update-location/{locationId} endpoint.

POST http://example.com/api/location/update-location/{locationId}
Content-Type: application/json

{
    "name" : "updated-name"
    "description" : "updated-description"
    "address" : "updated-address"
}

The request body JSON MAY contain all these fields. city, state, country, pincode, latitude, longitude, ticketPrice containing updatedstring data, cover-iamge1, cover-iamge2, cover-iamge3, slider-image1, slider-image2 and slider-image3 containing updated image data.

Fetching random location's data

Send a GET request to the /api/location/ endpoint.

GET http://example.com/api/location/

Search locations using search string

Send a GET request to the /api/location/search/{seaerchString} endpoint.

GET http://example.com/api/location/{searchString}

Get location's availability data

Send a GET request to the /api/location/get-availability/{locationId} endpoint.

GET http://example.com/api/location/get-availability/{locationId}

Temporarily lock a booking

Send a POST request to the /api/book/lock endpoint.

POST http://example.com/api/location/get-availability/{locationId}
Content-Type: application/json

{
    "locationId" : location-id,
    "noOfTickets" : 3,
    "bookingDate" : "01-01-0001"
}

Fetch the booking lock details

Send a GET request to the /api/book/lock/details/{lockId} endpoint.

GET http://example.com/api/book/lock/details/{lockId}

Finalizing the booking using the lock ID

Send a POST request to the /api/book/final endpoint.

POST http://example.com/api/book/final
Content-Type: application/json

{
    "lockId" : 123,
    "paymentId": "random-payment-id"
}

Submit a cancellation request to the admin

Send a POST request to the /api/book/cancel endpoint.

POST http://example.com/api/book/cancel
Content-Type: application/json

{
    "bookingId" : 123,
	"userId" : 1234
}

Approving the ticket cancellation request

Send a POST request to the /api/book/cancel/approve endpoint.

POST http://example.com/api/book/cancel/approve
Content-Type: application/json

{
    "bookingId" : 123,
    "adminId" : 1234
}

Send OTP for email verification or password reset

Send a POST request to the /api/auth/resend-otp endpoint.

POST http://example.com/api/auth/resend-otp
Content-Type: application/json

{
	"email": "lipapad224@wiroute.com",
	"otpType": "passwordReset"
}

otpType key can accept two values.

Use passwordReset when the OTP is to validate user for password reset.

Use emailVerification the email of the user needs to be verified (during first signup)

Verify the OTP sent to the user's email id

Send a POST request to the /api/auth/verify-otp endpoint.

POST http://example.com/api/auth/verify-otp
Content-Type: application/json

{
 	"email": "email@domain.com",
 	"otp": "anOtP",
	"otpType": "passwordReset"
}

otpType key can accept two values.

Use passwordReset when you want to validate the OTP sent to reset the password.

Use emailVerification when you want to validate the OTP sent to verify the user's email id.