What Is an API? A Complex Notion in Simple Words
TechnologyIf you deal with web development or internet marketing, you are most likely aware of what the abbreviation “API” stands for. Or at least you must have heard of the term at some point and know what’s behind it. For those who are new to programming, we’ll try to explain what an API is in the simplest terms possible.
The information presented in this article will be helpful for those who are only starting a website and wish to become aware of the mechanisms driving the web, as well as understand how to make them work on a newly built site to ensure the best user experience.
Of APIs and supermarkets…
This might sound a little far-fetched, but the truth is that APIs serve quite the similar purposes as supermarkets.
Imagine that you want to make a pizza. First of all, you need the ingredients. The most obvious thing that comes to your mind is that you have to visit a supermarket because this is where you can get all the stuff for making a pizza.
Now, what makes supermarkets so convenient? It is the fact that you can find all the products you need in one place instead of visiting several different locations or manufacturers. Thus, you don’t have to go to a butcher shop to buy meat or salami, travel to the nearest mill to get flour or pay a visit to a greengrocer. Everything you need is already there, on the supermarket shelves, waiting for you to get picked in a cart.
The same goes for an API. But in this case, your pizza ingredients are online services or information, and the pizza itself is a goal you want to achieve with their help. An API’s core purpose is to provide you with the required data and relieve you from the necessity to search for it elsewhere.
Any tangible API examples?
Perhaps you don’t realize it, but you use APIs quite often while surfing the internet. When you need to buy an air ticket, you don’t usually jump from one airline website to another. You just go to a site like Skyscanner where you can check out available tickets and compare prices – all in one place. This is because Skyscanner has direct access to online data provided by airline companies and can easily extract it in response to your specific request.
Online shopping works in a similar fashion. There’s no need for you to leave a merchant’s website and go to PayPal in order to pay for your purchase. The PayPal functionality is already embedded in the website you buy from. Or so it may seem. In reality, PayPal is not “integrated” with the merchant’s website in the true sense of the word. It rather offers its services remotely. An API, in turn, is a link that makes the interaction between the two online entities possible so that you could make your purchases on the internet.
In other words, the ability of individual web services to “communicate” with each other is made possible thanks to an API.
So what is an API in more specific terms?
Now, when the analogies have been drawn and the examples have been given, let’s turn to more technical terms.
API is an abbreviation for Application Programming Interface. Simply put, this is a programmed interface that enables interaction between a website or application and third-party online resources and services. In its basic sense, an API represents a set of functions (protocols and tools) that allow accessing a particular service and request data from it.
Programmers use APIs to obtain access to functionalities provided by all kinds of third-party services. In fact, an API is nothing but a medium allowing one service to use data or functionality of another service.
Thus, an API is pretty much like a waiter at a restaurant where a specific web service is a chef, while you, as a client, are a website or application. A waiter’s job is to deliver your order (a data request) to the kitchen and return with a meal (a reply from the remote server).
This is, of course, a simplified metaphor for complex processes in which APIs are involved, but it illustrates the working principle of the technology pretty well. Now, who needs APIs and why are they so important?
Who uses APIs and why
APIs allow web developers to save time by using pre-built software functionalities. This helps reduce the amount of code produced and effectively configure the interaction between different applications within one software platform.
Thus, APIs eliminate the need to create complex applications from scratch through the use of “ready-made parts” of existing resources which already have access to the required data.
From a user perspective, APIs are also seen as a way of simplifying complex tasks. Remember the supermarket analogy? Well, an API extracts and delivers you relevant data (usually in the JSON or XML format) from third-party resources just like a supermarket gets you pizza ingredients from manufacturers.
Nowadays, the API technology has become an indispensable part of the mechanism driving the World Wide Web with more and more services offering their APIs to the public. In fact, the overall number of APIs knew a 13x growth from 2007 to 2011, as GetElastic reports. This demonstrates how popular the technology is and at what pace it evolves.
Drawing a bottom line
An API can be viewed as a language enabling the communication between one service and the other. To put it in a different way, an API allows one program to carry out the requests of another program. It offers the following advantages:
- Allows web developers to save time for programming and integrate multiple services in one application;
- Expands functionalities of web resources and applications while giving users access to more features within one software framework;
- Delivers real-time data that is always relevant and accurate;
- Provides response data in XML or JSON formats allowing web services to integrate the required content.