API to get the list of hotels

In our travelling application, we need to show the list of hotels in a city (St. Petersburg, Russia at the moment, but more will be needed in the future). The idea was to find a hotel information provider, and then upload the complete list into our own database. The following info is needed for each hotel:

  • Name in English
  • Location (latitude / longitude)
  • An image would be nice
  • Probably, some sort of rating

We started with Booking.com, which does have API, but the API is NOT public, and one has to provide website/bank account information to become an affiliate and get the access.

Then, I had a try with GeoNames.org, which I once used for the list of populated localities in Europe. Unfortunately, the POI list in Russia is quite poor there.

We had next try with OpenStreetMap data. I’ve downloaded a 7 GB XML file with POIs of Russia. But I got disappointed once again after parsing it: only about 100 hotels in St. Petersburg + most names are in Russian.

Finally, we’ve found the solution. HotelsCombined has an easy-to-access and useful service to download the data feed files with hotels. 590 hotels in St. Petersburg – good enough! Here is how you get it:

  1. Go to http://www.hotelscombined.com/Affiliates.aspx
  2. Register there (no company or bank data is needed)
  3. Open “Data feeds” page
  4. Choose “Standard data feed” -> “Single file” -> “CSV format” (you may get XML as well)

Parsing the CSV file is a piece of cake, here is a sample Python code to filter out hotels from St. Petersburg:

def filter_hotels(from_file):
    with open(from_file, 'r') as fr:
        while True:
            line = fr.readline()
            if len(line) == 0:
                break # EOF

            hotel = line.split(',')
            city_code = hotel[5]
            country_code = hotel[10]
            if city_code == 'St_Petersburg' and country_code == 'RU':
                hotel_name = hotel[2]
                print hotel_name

Here is the complete list of fields in CSV/XML:

hotelId, hotelFileName, hotelName, rating, cityId, cityFileName, cityName, stateId, stateFileName, stateName, countryCode, countryFileName, countryName, imageId, address, minRate, currencyCode, Latitude, Longitude, NumberOfReviews, ConsumerRating, PropertyType, ChainID, Facilities

Update: Unfortunately, HotelsCombined.com has introduced the new regulations: they’ve restricted the access to data feeds by default. To get the access, a partner must submit some information on why one needs the data. The HC team will review it and then (maybe) will grant access. Sad but true. I’m in the middle of getting through this guarg, I’ll let you know about the result.

Update 2: Yes, we got the access to data feeds again. After reviewing the application form, HotelsCombined asked us to let them know our IP, white-listed it and now we can download the files. Still, I don’t know why they need all this procedure at all.

About these ads
This entry was posted in Public API and tagged , , . Bookmark the permalink.

5 Responses to API to get the list of hotels

  1. This is the answer I wrote on
    http://stackoverflow.com/questions/1185961/travel-hotel-apis/15672534#15672534

    In my search for hotel APIs I have found only one API giving unrestricted open access to their hotel database and allowing you to book their hotels:

    Expedia’s EAN http://developer.ean.com/

    You need to sign for their affiliate program, which is very easy. You get immediate access to their hotel databases plus you can make availability/booking requests with several response options, including JSON, which is more convenient and lightweight than the (unfortunately) more widespread XML.

    As you immediately access their API, you can start developing and testing, but still need their approval to launch the site, basically to make sure it provides the needed quality and security, which is reasonable.

    They also offer “deep linking”, i.e. you may customize your requests by adding parameters. Then if it sufficient for your purpose (for mine it is not), you don’t even need to store their content on your server.

    I have also signed for HotelsCombined program: (link removed as this site doesn’t seem to let me put more links)

    However, they do not immediately allow you to use their API even for testing. From their answer:

    “Apologies for the inconvenience caused, but it’s simply a business decision to limit access to our rich hotel content. Please kindly check back within the next 2-3 months, where we will be able to judge your traffic, and in turn judge your status on standard data feeds.”

    I have also signed for Booking.com affiliate program: (link removed as this site doesn’t seem to let me put more links)

    Unfortunately, again, they limit access, from their answer: “Please do note that, since there’s a high amount of time and cost involved in the XML integration, we are only able to offer the XML integration to a small amount of partners with a high potential.”

    I did not explore Tripadvisor as they seem only to offer top 10 hotels and only as widgets, but most importantly for me, they wouldn’t allow booking through them.

    I’ve checked the hotelbase.org mentioned above, they have very extensive list but not as rich as by Expedia, also they don’t seem to have images and don’t allow booking either.

    • Mike Shilkov says:

      Thanks Dmitri.
      At the time of writing my post, we didn’t like the Expedia because the amount of hotels for our target destination was too low. I can see that it’s still about 2 times lower comparing to HotelsCombined.
      Might be useful for others anyway.

  2. Mike says:

    I’m interested in finding a list of ALL hotels in Los Angeles county with kitchens or kitchenettes. Any ideas?

  3. Thanks your information helps. REALLY.

    There are plenty of websites offering hotels APIs to be integrated in an Affiliate partner’s website.. I am trying to find out which one is the best w.r.t. no. of hotels and % of commission. Can you help with some facts and information regarding that. I have registered myself for EAN (considering the brand value), but there is hardly any support and I am not sure if they give the best commissions on bookings. Do you have any comparison chart that lists some basic parameters for various API providers?

    It would be of great help.

    Thanks,
    HS

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s