devtr
devtr

Reputation: 11

How do I get the hotel codes for the given city from Amadeus hotel API?

I am not fluent in Python and do not understand clearly Amadeus API Python codes online. It is a work in progress. I want to find the code for the specific hotel and find its information with specific check-in and check-out dates. So, how do I get the hotel codes for the given city? I am using Google Colab.

!pip install amadeus
from amadeus import ResponseError, Client

amadeus = Client(
    client_id='My ID',
    client_secret='My secret'
)

try:
    # Get list of Hotels by city code
    hotels_by_city = amadeus.shopping.hotel_offers_search.get(
        hotelIds='RTPAR001', adults='2')
except ResponseError as error:
    raise error
print(hotels_by_city)

I used this but it's not working. Please help. Thanks.

I tried this code to find the hotel codes but it is not working.

Upvotes: 0

Views: 283

Answers (1)

MinjiK
MinjiK

Reputation: 159

Hotels APIs flow in Amadeus Self-Service API is recently updated with a new version so you may have an outdated code example.

Hotel Booking engine flow is available in detail here : https://developers.amadeus.com/blog/build-hotel-booking-engine-amadeus-api

  • First endpoint to get the hotel id is Hotel List API
  • 2nd endpoint to search price(offer id) based on Hotel Is is Hotel Search API
  • the last endpoint to book the offer is Hotel Booking API

Each code examples are available in the documentation : https://amadeus4dev.github.io/developer-guides/examples/code-example/#hotel-list

Upvotes: 0

Related Questions