What is an API?
Nowadays, we are connected to each other and the world like never before. We are all used to the instant connectivity that puts everything literally at our fingertips from computers or mobile phones. We can purchase anything, share information or search for it and of course, text or call each other and check news using social media.
But how does it work? How seemingly very different applications connect with each other, how is data transferred from different devices and different applications and websites with each other?
What Does API Stand For?
API Stands For Application programming. API interface The reason we can do all of the activities above is the API which stands for Application Programming Interface.
The definition of API is a computing interface that defines interactions between multiple intermediary devices. What that means is that an API provides a set of functions without the user having to worry about how they work.
Think, for example, a waiter in a restaurant. When you order a meal from a restaurant, the waiter writes your order and then goes to the kitchen tells the chef about the order and when it’s done, the waiter comes back with your food.
Here you don’t have to worry about what happens in the kitchen, you don’t have to worry about the food supply or the food getting burnt, but the waiter organizes all of that. The waiter in this example represents the API.
A real-world example would be the weather app on both IOS and Android devices. The weather app on both systems shows the weather anywhere in the world, but neither google nor apple have placed sensors all over the world instead they both partnered with the weather channel which provides them with an API that takes weather info from their database and displays it on your phone.
Uses of APIs
API is not used for sharing data only. They have a lot of use cases. One case is that app developers don’t have to worry setting up a wifi connection, drawing shapes on your screen or how to talk to the sensors of your device such as your gyroscope (allows your phone to know where it is in space can be used to put phone landscape mode for example) or GPS (to know your location like uber). Instead, the system provides a lot of APIs to simplify all of this. An app just asks the system to do what it needs.
It would be impossible for developers to write code for each function for each model that can use the app, doing so would millions of lines of code and would make any app considerably heavier.
Smart devices are becoming more and more popular, and APIs are the reason why they exist in the first place. Now you can order your speaker to play music through google assistant, Siri or
Alexa this is possible because the speaker manufacturer took the API of each the assistant and integrated into the speaker so they can speak with each other and in turn allows you to control it via these softwares
When an app asks for your permission to access something like your contacts or location, it doesn’t do so because it wants to but because the system does it for them and there’s no way around it. The system also allows you to revoke this permission anytime if you wish so.
Also, a lot of websites use the same concept. You can use your Facebook and google account to login to a lot of websites. It’s fast and convenient however this gives those websites some data from your social media account to make an account for you and can be misused since a lot of these permissions can last for a long time.
This concept is what allowed Cambridge Analytica to collect massive data through the Facebook API. They created a personality quiz which asked for some of your personal info which is fine. However, the permission allowed the app to access your data for months even if you didn’t use it anymore, which allowed Cambridge Analytica to gain massive amounts of data and use it in the trump 2018 election campaign.