What is an API?
Ok, so imagine you’re at a fast-food store, and you want to place an order. In this transaction, there are two important parties.
On one side there’s the customer – you.
And on the other side there’s the producer – the person flipping the burgers, tossing the fries and whipping up the milkshakes.
And in the middle, there’s the person on the check-out, who serves as an intermediary. They take your order, feed it through to the kitchen and then pass your food back to you when it’s ready.
This is a very simple, real-world analogy of how an API works. It takes your information and sends it across to the other party, which then interprets the data that you need and sends you something in return, via the API.
You probably use loads of APIs without even realising it. Here are some common everyday examples:
- Travel sites like Booking, Airbnb and Trivago. When you’re planning a trip, these sites allow you to connect directly with the flight and accommodation providers you need.
- Food delivery platforms like JustEat. When you’re hungry, they allow you to contact restaurants in your desired area.
- Google Maps and other location-based services. These allow you to see amenities, shortcuts and points of interest in the areas you visit.
In each of these cases, you could do the research yourself by contacting individual service-providers, like a hotel or takeaway joint. But it’s a hassle contacting each provider individually and, what’s more, you’re not guaranteed to find the most helpful and relevant results.
An API takes care of this. It takes the information you’ve provided, passes this information to all the providers that meet your criteria and then requests information back from each of them about their price, availability and other key factors. Then it presents the information to you in a clear, attractive format.