Last updated

Creating a hotel booking

The steps below explain how to create a hotel booking using Spotnana. All APIs mentioned below depend on each other, and the steps described in this section must be executed in the order specified.

StepNameEndpointDetails
1.Get hotel search results/v2/hotel/searchSearch for available hotels.

Request body requires: searchParams, filters, sortOptions, and userId. The userId can be retrieved using the query user API.

Response will contain: The list of available hotels based on the searchParams and filters provided in the request. The response will contain the details of each hotel and its price information.

Other APIs will use: hotels > hotelDetailsKey
2.Get hotel details/v2/hotel/detailsView a specific hotel and its details.

Request body requires: hotelDetailsKey from step 1, occupancy, dates, filters, and user details.

Response will contain: The hotel specifications such as the name, address, contact information, room selection, and price.

Other APIs will use: rooms > rateOptions > priceValidateKey for creating a new booking and bookedRooms > rateOptions > priceValidateKey for modifying a booking.

Note: The bookedRooms field will be populated only when modifying a hotel booking. The priceValidateKey is a unique identifier for the room rate and it will be regenerated every time there is a price change.
3.Verify hotel price/v2/hotel/price-checkVerify the hotel room price. Hotel room prices tend to change often due to demand and other factors. This API endpoint can be used to fetch the latest price of the selected room.

Request body requires: priceValidateKey from step 2.

Response will contain: bookingKey and priceChange (a boolean field to indicate if the price has changed).

Other APIs will use: bookingKey
4.Create a hotel booking/v2/hotel/create-pnrCreate a new hotel booking.

Request body requires: bookingKey from step 3, tripId, details about travelers who will be staying in the hotel room, payment details, and a point of contact. Use the tripData > tripId field to pass an existing tripId or use the create trip API to create a new trip.

Response will contain: pnrId , pnrStatus, and externalPnrId.

Note: The externalPnrId stores the source PNR ID retrieved from the Global Distribution System (GDS). If the hotel data is fetched directly from the supplier then the externalPnrId will be provided by the supplier.

Other APIs will use: pnrId and the externalPnrId (also referred to as cancelSourcePnrId ).