Let me start with a simple example of how an API can be used:
It is currently 2 degrees at in London
You may think that I’ve only tried a temperature in my statement, but the temperature is actually obtained from a weather site using an API. We will explain how it works in a practical way, but first I will explain a bit about what an API is.
What is an API?
API is one of the many three-letter acronyms that you encounter early on as a developer, but which many who do not deal with programming also come into contact with. API stands for Application Programming Interface. This does not, however, reveal as much about what API actually is.
Simply explained, it can be said that an API is a framework for how different programs can communicate with each other. You can compare it to a menu in a restaurant, which is a specification of what can be ordered by the restaurant. When you have said what you want, the restaurant will fix the cooking and will come back with your order when the food is ready. Similarly, an API can provide a description of what data can be requested and how to do it.
The family concept of being able to enter a URL in the browser and get to the right website is made possible by an API. When you type, for example, https://www.google.com/ in their browser and click on Enter, a so-called HTTP request is sent, whereupon answers come in the form of Google’s website.
Another everyday example that illustrates how APIs make life easier for both developers and users is a bank app. Let’s say that an association develops an app and wants to use the bank for secure login. In order to integrate the bank login, an API is used, which is a framework for how the association app communicates with the bank. The communication transformed into an everyday conversation could look something like this:
The association app: “Hi Mobile bank, now we have a user in our app here who would like to log in with your bank. The person is___ Can you help with that? ”
Bank: “Hey! We will solve that. Tell the user to open their bank app so they can identicate themselves.