Here’s all the basic information you need about API
We bet you have heard this term, and maybe used it multiple times. Actually, you use it almost every day, and you do this without thinking about it. You need it to call a cab or order a pizza. Please welcome “high and mighty” API.
What is API
Let’s start with the basics: what is an API? The abbreviation stands for Application Programming Interface, which literally means an interface for the programming of applications, no hidden meaning. The name, obviously, speaks for itself. However, it is better to consider this issue more accurately, since it needs a more detailed explanation.
As we have already mentioned, the API is an interface. This interface allows developers to use ready-made parts of the code to build an application. In the case of developing mobile applications, the library for interaction with a smart home can act as an API. This means that all the nuances are implemented in the library and you just refer to this API in your code.
In the case of web applications, the API can send data in different formats (different from standard HTML), which makes it a handy way to write your own applications. Third-party public APIs most often give you data in either of the two formats: XML or JSON. If you decided to make an API for your application, please, remember that JSON is much more concise (and easy to read) than XML, and services that provide access to data in XML format, gradually refuse the latter.
API in the web-applications
Now imagine, some kind of application, for example, Github, has its own API. It can be used by other developers. The way they use it depends on the capabilities that the API provides. Moreover, there is always a human dimension, so it also depends on how well the imagination of the developers works. The GitHub API allows, for example, to get information about a user, his avatar, subscribers, etc.
Let’s consider the Twitter API. The interface of this service can give you information about the tweets of the user and people who follow them. This is only a small part of the perks that anyone can get using the API of a third-party service (not to mention creating your own).
Why does your app need an API?
There are several situations in which you may want to create an API for your own lovingly written and refactored application.
- Mobile application. In case you ask this question, yes, a lot of mobile applications for various services work using the API of these same services. You describe the API, make a simple mobile application and the client with the smartphone will receive information straight in their devices through the API. It is convenient, and reasonable, after all, it makes sense.
- Well, there is a kind of unwritten rule – everything gets better if you use open source. Of course, it is a joke. All kidding aside, if your application has its own audience (who use it), you can also use it to your advantage. Moreover, the audience will benefit as well. All you need to do is to develop an API, with the help of which your users will be able to create new clients for your application, new services based on it and, perhaps, will discover its new sides.
- API is a way to separate frontend and backend. For example, you do this when you use frontended frameworks.
Single API is not enough
Creating a complete API for your application is only half the battle. How will you interact with the API? How will your users interact with it, and how will they use it?
The first thing that pops to mind is the usual series of HTTP requests. And if you are going to use it in order to get the right information, we ought to warn you – this is the wrong answer. The most obvious way, in this case, is not the most convenient and simple one, and it doesn’t matter how it sounds. It will be much more reasonable to create a special library for cooperating with the interface, which will describe all the necessary ways to receive and send information using the API.
Once again, we will use Github to give you an example. If you want to work with the API of this service (and its interface provides the most extensive possibilities), there are several libraries in various languages, for example, the Octokit. Any interested developer can find all the necessary ways to get information from GitHub and send it back through the service API, due to the documentation of those libraries.
This passage tends to suggest that if you create your own API, you should take care to create the libraries for interaction with them (using the most common languages). And be prepared for the situation when your application becomes popular, and somebody else creates their own library to work with your API. It can happen, and it is kind of a normal situation.
How to use API in the payments sector
In March 2019, the payment service provider Klarna announced the launch of its own Open Banking platform.
This solution will help merchants to access the consumers’ bank accounts at the checkout stage. Thus, this will initiate a transfer, but only after the customer inputs their account password. And all this is possible due to the bank’s API.
In 2018, HSBC launched the app called Connected Money. It gives its clients access to account data in 21 banks, including large ones. All of this has happened due to API too, and HSBC says that multibanking is not a bad idea. Moreover, this option is quite popular nowadays.
Now we can clearly see how API’s can be useful, and in which way merchants and financial institutions can implement PSD2 requirements.
SEE ALSO: Machine learning for dummies