Home Technology

API: how do our software communicate with each other?

Software now controls everything, be it a device or a service. Whether you’re uploading data to OneDrive, filming on your mobile, or filing a tax return, there’s one (or more) API running in the background to keep the process running smoothly. Communication between software is in fact no more than a simple data exchange, the mode or, if you prefer, the framework of which is provided by the APIs, ie the application programming interfaces.

What tree does the API create?

To greatly simplify matters, an API is a collection of routines and instructions designed to allow a software to retrieve data from another system or access its services and resources. The API is unique to each system, but it is always standard: anyone who knows the API of that system can use it.

So we can send data and requests with the help of an API to another system, which performs the requested task and then returns the result, also via the API, to the request host.

A truncated but illustrative example of a restaurant order. We ourselves are one of the “software” and the kitchen is the other system from which we want to get data – in this case food. We can’t go into the kitchen, so we can’t tell the chef directly what we want. Instead, we communicate with the waiter, handing him the order. He’s the API, he’s interpreting our wish, and he’s bringing out the food when it’s done.

What happens in the background, neither we nor the chef need to know; it doesn’t matter how many chefs you work in, it doesn’t matter how you cook the food, it doesn’t matter where the ingredients come from, etc. If we have access to the API, in this case the waiter, everything is given to get food on the table.

The same example can, of course, be viewed by ordering online; we open our favorite app on the phone, select the restaurant, and place the order. In this case, the phone app communicates with the restaurant’s computer via one (or more) APIs, and the end result is the same for us: food is placed on the table.

APIs in practice

According to the records, the first API was began to be used in. Salesforce.com was the first swallow, followed a few months later by eBay. Of the two, eBay has created an API for anyone to use, with the goal of integrating its services into anyone’s self-developed website in a matter of seconds. Since then, a lot of water has flowed down the Danube and the number of publicly available APIs has crawled over 24,000.

It is no exaggeration to say that APIs have flooded the world. With their help, the task of developers has become much simpler: with an API, a few lines of code can be used to integrate complex functions into any application. A simple example: we are developing a software or website and would like it to have a map feature that shows our site. Instead of embarking on costly and time-consuming development, we can easily integrate the map feature into the page using the Google API. Wouldn’t it be bad if users could sign in?

No problem, we can integrate the Sign in with Facebook option in a matter of seconds via the Facebook API. Do we also want a payment option? All you need is an API. Be it PayPal or a banking service?

Everyone has probably come across the examples above; this is a great indication that APIs have revolutionized development principles over the last ten years, but have also had an impact on user habits.

A fitness bracelet, for example, saves saved data. today you can not only transfer data within your own ecosystem, but you can also use APIs to export the data to your favorite platform.

Types

APIs can be divided into several groups based on their operation: REST, SOAP, GraphQL and RPC are the main types, and we can even distinguish operating system level APIs.

REST

The REST (REpresentational State Transfer) API is an API that is optimized for data retrieval. Requests and responses typically migrate between the parties using the HTTP protocol. Most Internet services use such an API. The advantage of the REST type API is speed and flexibility; the latter is due to the fact that several formats can be used for retrieval and instructions. HTML, JSON, XML – to name a few.

SOAP

A SOAP (Simple Object Access Protocol) APIs are also used for data retrieval, contrary to their name, typically when working with complex data sets. This is because in the case of SOAP, which also works via the HTTP protocol, the XML format is not an option but a requirement. The structure of the queries and all commands are in a standard format, which in turn provides greater security. APIs related to banking transactions, for example, are of the SOAP type, but REST is much more popular.

GraphQL

This API type is relatively new, it supports the JSON format. It looks very much that it may become more popular over time than the REST type; for example, when developing mobile APIs, developers prefer it. Although it works with more complex instructions, it makes it more difficult to program, but allows for much more precise (true, slower) data retrieval. It is not uncommon for a REST API to provide the desired information with more than one query, especially for a larger database, but for GraphQL, a single query is sufficient.

RPC / Web API

The purpose of the RPC (Remote Procedure Call) API is not to retrieve data, but to send a specific task to the remote machine. In this case, convenience is not necessarily the leading consideration, but a better allocation of performance and resources. If the communication is over the Internet using the HTTP protocol, the RPC API will become a Web API. A typical example of a Web API is Facebook login or Google map integration.

OS API

The operating system systems also include a wealth of APIs that allow software to, for example, use hardware resources. An Android program, for example, retrieves GPS data via the Android API, but Bluetooth, Wi-Fi, the camera, the use of many sensors work the same way, and we could list more.

Private and public APIs

APIs are by nature of use we can also group according to, in this case we can talk about open (public) and closed (private) APIs. One of the best examples of the former is YouTube, as videos can be accessed not only through the service provider’s own website, but also through a host of other applications; they all use APIs to access YouTube features (play, search, favorites, etc.). Closed-use APIs are typically developed by large enterprises, for their part, to facilitate communication and collaboration between departments.

If you liked the article, you might want to buy PC World magazine 2021/09, as we’ve packed it with useful and interesting content, plus software and a full PC game as a gift.

Are you more interested in IT? You can find our news and analyzes for IT and infocommunication decision makers here.

NO COMMENTS

Leave a ReplyCancel reply

Exit mobile version