» » API in mobile development - in simple words about what it is and why

API in mobile development - in simple words about what it is and why

At the moment, the Information Technology industry is one of the fastest growing. The development process itself is always the accumulation of a large amount of knowledge that must be constantly generalized and systematized. In turn, the process of systematization generates the growth of the terminological base.

Why is it important? The fact is that the larger the terminological apparatus, the more difficult it is for a person outside the industry to delve into the details.

With techies (performers) - everything is clear: they work with technology and use terminology all the time, because this significantly speeds up communication within teams. For the business (client), all these “words” only raise additional questions, such as: “Why is this needed? Why does it cost so much? Can we do without it?"

The Stfalcon team has extensive experience in developing mobile applications, and we often encounter questions that can be classified as “typical”. One of these "Why does a mobile application need an API?"

To make it easier to understand this issue, let's take a look at what an API (Application Programming Interface) is, what functional tasks are assigned to it, and why a mobile application cannot do without it in the “just about complex” format.

Interface


It is best to start understanding the concept of API from the word interface. it is fundamental and has a broader meaning. To make it easier to do this, let's move away from the world of software engineering and return to everyday topics.

Answer the question, what functional tasks does the car perform.

Most likely, the first thing that comes to mind is moving a person from point A to point B. In general, this is the basic function, but transporting something or, say, earning extra money is already secondary tasks.

The second question is, due to what the movement, acceleration, braking and other functions occur. Without delving into the details, this can be answered as follows: “A car, like a vehicle, consists of many interconnected components and at a higher level there are only three of them, these are: body, chassis and engine. In turn, each of these components consists of more highly specialized devices and mechanisms that interact quite closely with each other. As a result of this interaction, we get what we need from the car.”

A modern car is a rather serious engineering solution, while the driver does not have to deal with all this complexity, it is simply hidden from view. And as you understand, it is hidden behind the interface :)

Yes, you read that right: the steering wheel, the accelerator pedal, the gearbox, the climate control, and even your favorite radio tape recorder are all part of the interface that is left to the driver to manage all the complexity.

The interface is quite common in our life:

- a person working at the machine has at his disposal all sorts of knobs, buttons, display, etc.;
- when you change channels with the TV remote control;
- when you use voice dialing on your smartphone,
- play the console with a joystick,
- and even when playing the piano.

Considering the above examples, let's try to define this concept.

An interface is a boundary between two systems, which is a set of rules, methods and restrictions by which these systems interact with each other.

If we analyze this definition using the example of a car, then we can distinguish two systems: a person and a machine. The machine sets certain rules, observing which, a person can control it.

API and RESTful API


Having dealt with the basic component of the term, we will continue to decipher the remaining two words, or rather Application Programming.

The name itself hints at the belonging of the term to software. Drawing an analogy with the same car, we can conclude that the API is again two systems and rules, just in this case, software modules, web services, etc. act as systems.

In principle, this could be the end of the API, but it would be wrong not to mention the RESTfull API. The fact is that the API - describes, as it were, a phenomenon. In turn, the RESTfull API (or simply REST API) is one of the approaches to implementing the API.

This is important to understand. often in dialogs they use the API for brevity, assuming that it will be implemented through the RESTfull API.

API in mobile development - in simple words about what it is and why

Answer to the main question


Armed with the knowledge of what an interface is, and even touching on a more highly specialized concept like a RESTfull API, it will be much easier for us to answer the main question “Why does a mobile application need an API?”.

Let's start with "anatomy". A mobile application consists not only of the visual part (UI - User Interface). During development, a number of other issues need to be resolved, for example, where to store data - information about users, messages, orders. Also, the application must perform certain functions, for example, accept payment, authorize the user, send SMS during registration or push notification when an event occurs.

There are many tasks, but which of them (or maybe all?) is the reason for creating the API? Answer: none. Because all this can be implemented without an API within a single smartphone.

In fact, the root cause is the multi-user nature of the mobile app. After all, as soon as more than one user appears, the problem of data exchange between them immediately arises.

Imagine the situation, the user has changed his name. If the profile data were stored only on the smartphone, the other user would not be able to know about these changes.

In addition to data exchange, there are other problems: what to do if you lose your smartphone or reset it to factory settings; what about supporting hundreds of different devices.

All these tasks are solved by centralizing the business logic, and just to access it, an API is being developed (or rather, as we already know, a RESTfull API).



Another case where you can't do without an API. You want to provide customers with access to data or features for a fee.

For example, we can take SMS aggregators, the main task of which is to send sms. In this situation, the developer does not need to understand the full complexity of the device of mobile networks. All that is needed is to integrate with the SMS aggregator API and to send, just call the desired API method.

Given the above, we draw a key conclusion : in order to perform its functions, a mobile application accesses an external server that centralizes business logic (also called Backend).

To access the server, an API is needed, that is, a certain set of rules by which the client, or rather the application, will access it.

In practice, it looks like this. For example, you want to create an order. In this situation, your Android or iOS application will send a command to the server via the API to create an order. The server will execute the request and save the information to the database, thereby making the order data available to other users.

I hope this article will allow you to finally understand this issue.

All the best :)

Related Articles

Add Your Comment

reload, if the code cannot be seen

All comments will be moderated before being published.