Press enter to see results or esc to cancel.

Google Flights API: Incorporate Travel Data into Your App

This edition of #12DaysOfAPIs, we’re profiling the Google Flights API! Read on to learn how to add in flight search into your script or start making calls right away from your browser.

screen-shot-2016-12-29-at-9-57-28-pm

(Source: Custom)

So, what can you do with the Google Flights API? 

If you haven’t tried the Google Flights website before, you should check it out.

Basic RGB

(Source: Money Inc.)

Google Flights lets you comprehensively search available flights by price across multiple airlines in one, easy-to-use interface. Google Flights’ clean interface and open-ended search functionality make it different from other flight search applications.

Google Flights is largely powered by the Google Flights API, which came from its 2010 acquisition of ITA software and its QPX API. The Google Flights API returns a number of values, letting you go as broad as general price information and tickets, or as granular as infants-in-seat vs. infants-in-lap (read the full list of returns here).

Why we ❤️ the Google Flights API

Unlike actually planning travel (we’re still recovering from the holidays ourselves!), using the Google Flights API is remarkably simple. In fact, our package only uses two endpoints: searchSingleTrip and searchTrips. These endpoints are pretty straightforward.

  • searchSingleTrip: This endpoint returns all data for a single trip’s worth of flights.
  • searchTrips: This endpoint will search multiple flights based on user parameters.

Searching for flights is a very useful integration, especially since the Google Flights API doesn’t discriminate by airline. While the first 50 queries of the day are free, afterwards you pay $0.035 US per query.

How to call the Google Flights API

Ok, who’s ready to call the Google Flights API and search some flights?

flight-api-gif

(Source: GIPHY)

Here’s how to do it.

Step 1: Get an API key from Google

First things first, you’ll need to get an apiKey from Google itself. Here’s how:

  1. Go to Google Developers Console
  2. Log in with your google account or create a new account
  3. Select a project, or create a new one.
  4. Go to the QRX Express Airfare API Dashboard on Google’s API Manager (remember, Google acquired this API, so the name of the API isn’t “Google Flights API”)
  5. Click the “Enable” button towards the top of the page
  6. Go to the Credentials tab on the left side of Google’s API Manager to get your apiKey

Step 2: Make an API call from your browser from RapidAPI

Now that you have the apiKey, you can call the API from RapidAPI’s Google Flights package page.

  1. Head over to the Google Flights package page on RapidAPI.
  2. Pick an endpoint and fill in the parameters (including your apiKey from Step 1).
  3. Hit “Test Function” to call the API.

Here’s what a successful API call looks like.

Once you’ve made a successful call, you can export the Google Flights API code snippet into your script. Just pick your language and copy the code. If you decide to incorporate multiple APIs from RapidAPI into your app (browse what’s on the marketplace here), you won’t need to download multiple libraries. You can call multiple APIs from a single RapidAPI endpoint.

Project ideas

Speaking of multiple API integrations, here are some project ideas that you can build with some of the existing APIs on the marketplace.

  • Dedicate a Slack channel to potential office retreat ideas based on Google Flights
  • Decide on layover stopes by Google Flight prices and Yelp reviews of the airports
  • Build the ultimate travel app that with Google Flights and a built-in translator with Google Translate
  • Integrate Google Flights API and Plivo or Twilio‘s text messaging APIs to get text notifications when a flight becomes available at a price you set

Let us know what you build in the comments below!

Need more inspiration? There’s one more week of APIs left! 

If you want more API ideas, check out our #12DaysOfAPIs series on the blog or follow along on Facebook or Twitter (@rapid_API). You can also browse our existing APIs on the marketplace. We add more every week! If you sign up for an account using an email address, we’ll send you a weekly update of what’s new to the marketplace.

 

 

Comments

2 Comments

Di Gan

Will you able to pull all the data from their API?

run 3

… [Trackback]

[…] Read More on|Read More|Find More Infos here|Here you can find 8442 more Infos|Infos to that Topic: blog.rapidapi.com/2016/12/30/google-flights-api-incorporate-travel-data-into-your-app/ […]


Leave a Comment

Tell us your thoughts!

Spread the API ❤️