There are four required and one optional step to the booking flow.
- Checking availability (this could include Hotel Availability, Expanded Availability and Booking Availability (/availability)
- Submitting a booking for a room (/booking_submit). This call requires an HTTPS connection.
- Verifying that the booking was successful (/booking_verifiy). This call requires an HTTPS connection.
- Optional: Support cancellation of a booking (/booking_cancel). This call requires an HTTPS connection.
Availability results will then be displayed to the user. The user will select one of the available rooms and provide their name, address and payment information.
This information will then be transmitted using the /booking_submit call to request a booking. If successful, the reservation details (including a unique id) will be returned.
Using the unique id, TripAdvisor will send a follow up request (/booking_verify) to ensure the booking was successfully made.
The HTTP or HTTPS URL to an API implementation is called a 'partner endpoint' or just 'endpoint'. In this documentation, the url:
http://www.partner-site.com/api_implementation will be used as the example endpoint to a fictitious HAC API implementation.
All Instant Booking API requests from TripAdvisor are sent as a HTTP POST request. All parameters will be application/x-www-form-urlencoded, except for the booking_submit and booking_cancel requests in which case the Content-Type will be set to application/json.
All responses must conform to the JSON specification and be sent with the HTTP Content-Type header set to application/json.
All responses must use UTF-8 encoding.
All responses must return status code 200 (success). Any other status code is not acceptable. This includes status in the 300s (which indicates redirection), 400s (which indicates client error), and 500s (which indicates server error).
Responses must not redirect to another URL. All the URLs in the API below do not use a trailing slash and you cannot redirect to a URL that contains one.
JSON Data Types
There are a few datatypes used throughout this API.String -
- Most values are strings. Strings must have quote marks around them. As stated above, empty strings are unacceptable for optional fields. Do not use control characters like \r, \n, or \t in Strings.
- A number can be used to represent anything from a TripAdvisor ID to a price. Numbers should not have quotes around them. Numbers can also have decimal points if needed
- Can only be the word true or false. Booleans are not written in quotes.
Your API needs to perform at a certain speed in order to handle TripAdvisor traffic. For best performance, responses to requests should take no longer than 5 seconds on average.
Additional Parameters in TripAdvisor Requests
TripAdvisor may add new parameters to its API requests at future dates. Those may not be documented at the time of your implementation so you should not validate against new parameters. These newly released parameters should not cause your API to return errors.
Once you have finished building your API Endpoint, please use the API Viewer to validate your endpoint.