What Is an API and Why Were They Created?


When you hang around programmers, you might have heard about API and how they can be used to perform certain tasks or retrieve some data. But what are these APIs exactly, and why were they created.

Table of Contents

What Is an API and How It Works?

The term API stands for programmable application interface, and it’s a way for different programs to work together in various ways. Let me explain API to you with a simple, nontechnical related example.

When you go to a restaurant and order some food, you interact with the waiter; you can order food and drinks, ask questions about the menu request, then pay the bill and much more. In this example, the waiter is shielding you from all the complicated stuff that happens behind the scenes. You don’t have to worry about stoves ovens dishes managing stock or pouring drinks.

working in restaurant

He is the interface between you and all of the services that a restaurant offers, giving you a way to interact with the restaurant while still shielding you from all the complexity behind the scenes. In a way, the waiter can be seen as the API of the restaurant, and through this example, you intuitively understand why they are useful.

What Are the Benefits of API?

1. APIs Can Be Used to Access Data From 3rd Party Services

For starters, API can be used to get access to data from third parties. In the restaurant example discussed in the above section, the waiter can give you information on the status of your order without you having to go to the kitchen yourself.

Another example would be the weather app on your phone. Do you think Google, Apple, and other smartphone companies have not gone out and put temperature sensors all over the world? Hence, you get to see the approximate temperature in your location? No, instead of applications installed in your smartphone, use the API of a third-party service to retrieve weather predictions.

weather in apple watch

Apple, for instance, is using the application programming interface of The Weather Channel to retrieve and automatically display the latest weather predictions on their customers’ devices.

API is the only thing that allows different apps and services to exchange information. These days it’s hard to find a service that doesn’t have or utilize the unlimited possibility of application programming interface. Today there are APIs to look up recipes, lyrics, information on barcodes, zip codes, available parking spaces, public holidays, and the list goes on and on.

2. API Helps Abstract Complexity

But aside from just accessing data, API can also be used to hide complexity and perform tasks. In the restaurant example, you don’t need to know how to prepare a perfect roll of sushi, and you just order one.

notification in apple iphone x

Another example would be the operating systems on our computers and phones. App developers don’t have to worry about setting up a Wi-Fi connection, drawing shapes onto the screen to make a beautiful user interface, or how to talk to the various sensors like the accelerometer or G.P.S. Instead, the operating system gives developers a bunch of APIs that simplify all of these crucial tasks.

If an app wants to show a button on the screen, it just asks the system to render one. The app doesn’t have to worry about what device it is running on, what hardware it has, screen resolution, or anything like that. It makes developers more efficient because they can focus on what matters to them.

3. Extend Functionality

Aside from accessing data and abstracting complexity, API can also be used to extend functionality. For instance, iOS applications can show a widget in the notification center, and do that; the app notifies the system through an API that it has a widget available. If the user now adds this widget to their notification center, the system will contact the app and ask how it should display the widget.

Another example is Siri, Google’s Assistant, or Alexa. These personal assistants are quite intelligent, but external developers can use the provided application programming interface of these AI-based assistants to extend the functionalities even further.

amazon alexa at my home

My Google Home, for instance, didn’t know how to turn my smart outlets on or off, but that changed when the vendor integrated with the Google assistant through its API. Suddenly Google became aware of the new hardware, its capabilities, and how to interact with it.

4. API Can Be Used as Gatekeepers

You might not realize it, but APIs are all around us. You’ve probably seen messages like these your phone asking for permission to use your location or microphone, and that brings us to the final use case.

API can be used as gatekeepers. For instance, on mobile platforms, the system only has a handful of APIs that can be used to get your location. And because it’s centralized in the system, it’s really easy for iOS or Android to notify you when an app is using your location.

So it’s not the app that is being nice and asks your permission first. No, it’s the system that does it for them. There is no way around it. What’s more, the system also gives the ability to revoke this permission at a later time, should you change your mind.

facebook screenshot

So every time your phone asks for your permission, you know that an app is using an application programming interface of the system and one that is privacy-sensitive. And while this is great, there is an issue with this. Usually, permission is only asked once. You might have used your Google or Facebook account to log into another website or app. It’s easy, fast, and convenient, but by doing that, we also the site or app the permission to access some of our data like our name or email address.

This is great because it puts us in control of our personal data. If you don’t want to share it, you just deny it. However, the problem here is that sometimes these permissions are long-lasting, and after a while, we forget what apps or websites we gave permission to access our data. This is what allowed Cambridge Analytica to collect massive amounts of data through the Facebook API.

Cambridge Analytica created a personality quiz that asked for permission to get some of your personal data. However, if you gave it permission, the app could silently access your data for months, even if you didn’t use it anymore. Instead, you had to revoke the permission through the Facebook website.

So, in short, the API can act as gatekeepers protecting our personal data and only giving it out to the apps that we choose. But we should be aware of how long these permissions last and revoke them when we no longer use an app.


APIs are all around us. They are used to get access to data so that multiple apps or services can work together. They can also hide complexity for developers allowing them not to waste time figuring out how G.P.S. works, for instance. APIs can also be used to extend the functionality of existing systems. And finally, they can act as gatekeepers to protect our personal data.

I hope this guide will bring some clarity to this technical and complicated topic that is mostly discussed among developers. Let me know your thoughts or questions in the comments below.

Google Plus Pinterest