DEV Community

Aditi Chaudhry
Aditi Chaudhry

Posted on

What is an API?

This article was first published on Medium. You can take a look at it here

API's are the unsung hero of our connected world. They connect different devices and applications to each other enabling us to have the world at our fingertips. But what exactly is an API? The following is a high-level overview of what an API is. The implementation details will vary depending on the requirements and complexity of the system you are trying to build.

API stands for "Application Programming Interface." Wikipedia defines an API as "a set of subroutine definitions, protocols, and tools for building application software". APIs are a wonderful tool for developers because they simplify programming through abstraction. The developer has access to the objects and actions they need and doesn't have to worry about the underlying implementation.

An API is the interface that allows software applications to communicate with each other. It is like a messenger that relays requests and responses between two parties. Let's walk through an example. Imagine that an API is a waiter at your favorite restaurant. You are sitting at the table looking at the menu deciding what to order. The kitchen, aka the provider, will fulfill your order. But how will the kitchen know what you want and how will you get your food from the kitchen? Enter your waiter, aka the API! The waiter takes your order (the request), delivers it to the kitchen and then delivers the food (the response) back to you.

Now, let's apply this to a real API example. Let's say we are booking a hotel for a trip to Disney World. The process for searching for a hotel online is similar to choosing an entrée on a dinner menu, except it's probably a dropdown menu. You choose the day you would like to check-in, check-out and other variables such as room preference.

In the process of booking your hotel room, you are interacting with the hotel's website to access the hotel's database to see if there are any rooms available on those dates and what the cost will be.

But what if you are using an online service that displays information from multiple hotel brands instead of just the hotel's website? Just like you interacted with the hotel's website to get the information, an application will interact with the hotel's API.

The API is the interface, like the waiter, that runs and delivers the data from the online service to the hotel's system over the Internet. It then takes the hotel's response and delivers it back to the online service. Through each step of this process, the API facilitates the interaction between the online service and the hotel's system. The same is true for all interactions between applications, data and devices - APIs are what allow devices and applications to connect to each other to move data from one point to another.

We have APIs to thank for the sites that provide us with the best deals on hotels, travel, etc. But more importantly, APIs have enabled us to live in an interconnected world.

This is the second post in my "What is" tech blog series. I'll be writing more every week here and on my blog!

Top comments (1)

Collapse
 
ayoalfonso profile image
AyoAlfonso

Love your article. I was wondering, on the analogy you used. Don't you think more than being a "waiter" the API is more or less like the accepted language or protocol that is used between the waiter and you to pass a request? It's an interface, I think the servers that handle the packets of data are actually the "waiters".