Step 2: Requesting room rates
With the sandbox key, you can now query the API for room rates.
For this guide, we'll use the documentation's API reference to make calls. You could instead make calls using the liteAPI Postman collection or your preferred programming language. The API reference page offers examples in many languages, and we have SDKs with examples available for when you are ready to begin building your application.
Navigate to the get hotel rates and paste your sandbox key into the AUTHORIZATION header at the upper right of the page.
Now it's time to add the query parameters for the stay for which we want to find rooms and rates. These are located partway down the middle of the page.
The first required field is an array of IDs belonging to the hotels for which you want to check rates. Click the "+" to expand and see the field options and to add additional entries. There are quite a few ways to compile that list of IDs. For instance, one way is to use the static data endpoint to pull all the hotel IDs for a given region. Check out Preparing a List of Hotel IDs for more on that topic. For now, use the example hotel ID provided.
The second section uses an array of occupancies. In this example, we will only need one, but more multiple can be sent when looking to book several rooms for a group at once. Each room occupancy is defined by the number of adults staying in the room and the age of any children also staying in that room. Children are passed as an array of integers.
Currency and guest nationality are next. The example values listed are for the United States.
The next two fields are more obvious: enter the check-in and check-out dates of the stay in yyyy-mm-dd format.
Once the fields are entered, press "Try It!" to fire off the API request. Here we have CURL selected, but choose the language you are most familiar with to see the request in your preferred syntax.
If successful, you will get a 200 response detailing available rates and a lot of other metadata. For now, notice that each room has an associated offerId
. This offerId
is used in the pre-booking step, so copy the offerId
for the rate(s) to use in the next step.
⭐️ Note: The offerId
is very long, so make sure to copy the whole thing but do not include the quotation marks wrapping the offerId
.
Updated 6 months ago