I am working with Booking.com’s API through RapidAPI and need some guidance. I want to fetch hotel reviews, but I’m unsure how to obtain the required hotel ID for a specific property. I need help identifying the correct parameter value to use in my API call. Below is an example of my current code. Can someone provide insight or alternative methods to retrieve the hotel ID?
import requests
endpoint = "https://booking-com.p.rapidapi.com/v1/hotels/reviews"
params_data = {
"hotelId": "1676161",
"locale": "en-US",
"sortCriteria": "SORT_BY_RATING",
"travelerType": "individual,group",
"langFilt": "en,es,fr"
}
headers_info = {
"x-rapidapi-host": "booking-com.p.rapidapi.com",
"x-rapidapi-key": "your_api_key_here"
}
result = requests.get(endpoint, headers=headers_info, params=params_data)
print(result.text)
hey, i found that using the search endpoint can directly return the hotel id. it’s a more reliable way than scraping page data. check the api docs for any updates that might affect the field names. hope this helps, cheers!
In my experience working with Booking.com’s API, I discovered that an alternative approach involves using a preliminary property search request to extract the hotel ID instead of relying solely on page inspection. There is an endpoint that allows you to search for hotels by city or name and returns detailed information, including the unique ID. This method bypasses potential changes in the page structure and provides consistency. I recommend reviewing the API documentation to find the appropriate search endpoint which reliably supplies the hotel ID required for subsequent review calls.
hey, try checkin the booking page source - often the hotel id is hidden in a json blob or meta tag. i had similar probs and found that inspectin the network data sometimes reveals the id you need. good luck!
During my work with the Booking.com API, I encountered this issue and discovered an unconventional route. Rather than relying on typical desktop page inspections, I used mobile emulation in my browser. Switching to a mobile view unveiled an API endpoint that returned a detailed JSON payload with the hotel id clearly listed. This method proved more consistent as mobile endpoints often expose less obfuscated information than the standard website. It’s worth testing with developer tools in mobile simulation mode to capture these responses and confirm the correct id.
I encountered a similar challenge while working with the Booking.com API a few months ago. I found that besides examining the source code, using your browser’s network inspector proves to be very useful. When you load the hotel’s page, you can spot preliminary API calls which include detailed JSON responses; here, the hotel id is usually embedded within the data payload. I recommend filtering for XHR requests to locate these responses. Additionally, some tools allow you to extract the IDs directly from these network calls for further confirmation about which id to use.