Can someone guide me on obtaining the hotel ID for a booking site?
I am currently utilizing the API provided by RapidAPI for booking.com, and I wish to retrieve hotel reviews. However, I am uncertain about how to identify the hotel_id
needed for a specific hotel.
import requests
api_url = "https://booking-com.p.rapidapi.com/v1/hotels/reviews"
query_parameters = {
"hotel_id": "1234567",
"locale": "en-us",
"sort_type": "SORT_HIGHEST_RATED",
"customer_type": "family,group_of_friends",
"language_filter": "en-us,fr,de"
}
headers = {
'x-rapidapi-host': "booking-com.p.rapidapi.com",
'x-rapidapi-key': "your_api_key_here"
}
response = requests.get(api_url, headers=headers, params=query_parameters)
print(response.text)
Is there a method or endpoint to search for the hotel ID based on hotel name or location?
Had the same problem with booking.com API through RapidAPI. The search endpoint works, but I’ve found another way that’s sometimes better. Hit the /v1/hotels/locations
endpoint first to grab location details, then pass that to the search function. The hotel_id usually shows up as hotel_id
in the response, but I’ve seen it as b_hotel_id
or accommodation_id
too - depends on how the response is structured. Watch out though - some hotels have multiple IDs across different booking systems. Make sure you’re pulling the one that’s actually for booking.com.
for sure! try the /v1/hotels/search
endpoint. just enter the city or hotel name, and it’ll return the hotel_id along with other info. that way, u can get the hotel_id for the reviews you want.
The hotel ID can be found directly in the booking.com URL when viewing a hotel’s page. Check the address bar for a parameter like hotel_id=12345
or something similar, and you can extract it from there. When using the search endpoint, ensure you examine the JSON response thoroughly, as the hotel ID may not be immediately visible but could be nested within the results. It’s worth noting that different API versions might label it differently, so keep an eye out for hotel_id
, id
, or property_id
in the output.