API - Let's make it simple
So, explain to me, what is an API?
(It's a question I like to ask in an interview once I hear that the candidate has worked with one in his previous role).
Quite surprisingly, not many people can clearly explain this concept in simple words, and I'm not surprised.
If we search for the definition of API online, this is what we will find:
"In computer programming, an application programming interface (API) is a set of subroutine definitions, communication protocols, and tools for building software. In general terms, it is a set of clearly defined methods of communication among various components. A good API makes it easier to develop a computer program by providing all the building blocks, which are then put together by the programmer."
Now, let's try to break down and better understand this concept.
We live in a world that thrives of connectivity. At the edge of our fingertips, (and on the other side of our screen) there is a whole world that allows us to shop, post, search and enjoy a wide range of content from anywhere in the world. But let's think about it, how does Data get from point A to point B?
API - stands for "Application programming interface" - It is an "Under the hood mechanism" what makes it possible for numerous interactions we perform with different applications and services.
Some time ago, I saw this great analogy on Twitter that really makes it simple for people to understand what is really an API.
Imagine that you are sitting in a restaurant, in front of you there is a menu. In order for you to receive anything from the kitchen, you need to state your order to the waiter, and it has to exist on the menu.
Once you place your order the waiter will go to the kitchen, and return to you with your food.
In other words...
You are the client, the waiter is the API, and your order in an API call which the restaurant exposed to you so you could use it to retrieve items from the kitchen which is the server. The API in the critical link which allows us to receive responses what the desired service.
In real life...
Think about an online shopping website that searches and aggregates results from various different online stores. The website interacts with the stores via the API they expose so he could provide you with the response. Just like asking your waiter, you are making a search on the website, the website communicates an API call to the store's interface, and "retrieves" the response back to the website which displays it to you.
The same principle applies to various interactions between applications, devices and Data.
I hope this simple and short explanation made it easier for you to understand the concept of API and it's place in our everyday activities. Read, explore and never stop learning.
Credit to Aarthi Dee on Twitter.