Locating the hotel_id on Booking.com for API usage

I’m working with the Booking.com API through RapidAPI. My goal is to fetch hotel reviews but I’m stuck on finding the hotel_id. This is a required parameter for the API call. Does anyone know how to get this ID for a specific hotel?

Here’s a sample of what I’m trying to do:

import requests

api_endpoint = "https://booking-api.example.com/v2/hotels/feedback"

query_params = {
    "property_id": "unknown",
    "language": "en",
    "filter": "recent",
    "traveler_type": "solo,family"
}

headers = {
    'api-host': "booking-api.example.com",
    'api-key': "your-api-key-here"
}

response = requests.get(api_endpoint, headers=headers, params=query_params)

print(response.json())

Any help would be appreciated!

In my experience, the best approach is to first use Booking.com’s search functionality. When you find the hotel’s page, inspect the URL for any numeric sequence following ‘/hotel/’ or search the page source for identifiers like ‘b_hotel_id’. I’ve also found success with the autocomplete API endpoint, where you send a GET request with the hotel name to retrieve the hotel_id. This method has proven reliable on several occasions. I hope this information helps you with your project.

hey flyin star, i’ve been messin with that api too. try checkin the hotel’s url on booking.com, sometimes the hotel_id is in there. like …/hotel/us/example-123.html, the 123 might be wat ur lookin for. if not there, maybe inspect the page source? good luck man!

I’ve encountered this issue before when working with the Booking.com API. One effective method I’ve found is to use their autocomplete API endpoint. Send a GET request with the hotel name as a parameter, and it typically returns the hotel_id along with other details. This approach has been quite reliable in my projects.

Another option, if you prefer manual inspection, is to examine the hotel’s page source. Look for data attributes or JavaScript variables containing ‘hotel_id’ or similar identifiers. This can be time-consuming but often yields the necessary information.

Remember to respect Booking.com’s terms of service and rate limits when using their API. Good luck with your project!