What’s happening behind the scenes?
Without getting too far into the weeds, an API will offer a bunch of actions that Google or other travel providers can take by using the API. These actions are exposed as ‘endpoints’. An endpoint is basically a URL, which looks like this:
https://api.ba.com/selling-distribution/AirShopping/17.2/V1
Each endpoint allows me to take a specific action, which is often called a ‘resource’. If I look at the British Airways API, some of the actions I can take (resources I am offered) are flight availability, seat availability, pre-purchased luggage offers, and flight booking. AirShopping, in the URL above, is the flight availability endpoint.
APIs work on a request/response basis, like any good conversation. At a very high level, I can make a request to an API to retrieve data (as in the example above), to create new data (if you went on to book the flight), or to update or delete existing data (if you changed or cancelled your flight). The API will respond either by providing the data I have requested, by confirming that I have successfully created/updated/deleted data, or by telling me I’ve done something wrong.
If I wanted to use the AirShopping endpoint above, I would pass a bunch of data to that endpoint (origin, destination, date, etc), and I would receive a response with a bunch of data in return (available flight times, cost, stopovers, etc).
Why do APIs matter?
APIs matter because they make it easier for teams and companies to work together. When Uber launched in 2009, it didn’t have to build its own maps or spend months working with Google to integrate Maps into the Uber app. Uber’s engineers simply looked at the Google Maps API documentation and figured out how best to use Google Maps given the rules that the documentation provided them with.
APIs allow companies like Uber to launch and scale quickly as they can consume services that they don’t need to build themselves (maps, payment, SMS, etc). At the same time APIs also allow the companies who provide those services (Google, Stripe, Twilio) to offer them to what is effectively the entire world.
APIs are also a fundamental building block of the internet, and have played a major part in allowing the web to scale to the degree that it has. When you enter a URL into your browser, your browser is making an API call on your behalf. It requests the data that sits at that address (the URL) on a server somewhere, receives the data in a response from the appropriate server, and then follows the instructions in the data that describe how the page should be constructed. APIs are behind everything.
That’s it?
That’s it. There are some definite best practices in building and using APIs, and there is not a single API standard that is universally agreed on. But for the purposes of ‘what the hell is an API?’, that’s all you really need to know!