API in Mobile Development - What It Is and What It's For in Simple Words
At present, the industry of IT is one of the most rapidly developed. The process of development is always accumulation of a great amount of knowledge, which must continuously be generalized and systematized. The process of systematization in its turn results in the expansion of basic vocabulary.
Why is it important to mention? The point is: the wider the basic vocabulary is, the more difficult it is to delve into the details for a person, who does not belong the industry.
Everything is clear with techies (contractors): they work with technologies and use the terms constantly, since it significantly speeds up communication within teams. For a businessman (a client), all these «buzzwords» raise only additional questions, of the following type: «Why is this necessary? Why does it cost so much? Can we do without it?»
Stfalcon team has an extensive experience in mobile app development, and we often face the questions, which can be qualified as «typical». One of them is «Why do we need API for a mobile application?»
To make the understanding of this issue easy, let’s discover what API (Application Programming Interface) is explained in simple words. We’ll find out what functional tasks it has and why a mobile app cannot do without it.
Interface is the best word to start with when dealing with the notion of API. The interface is the primitive concept, which has a wider meaning. To make things simple, let’s not delve into the engineering and software aspects, but turn to the general topics.
Answer the question: What functional tasks do the automobile perform?
Most likely the first thing, which will occur to you is moving a person from point A to point B. In general, it is really the basic function of an automobile, transportation of some things or earning money are minor possible features.
The second question is what makes the vehicle move, speed up, slow down? Not going into details, we can say that an automobile as a means of transportation consists of multiple interconnected components. At the upper level, there are 3 of them: body, understructure, and engine. Each of these components in its turn consists of the more narrowly specialized devices and mechanisms, which work hand in glove with each other. As a result, we get what we need from the vehicle.
A modern car is rather a serious engineering solution, however, a driver does not need necessarily deal with all these, it is simply hidden from view. As you understand it is hidden behind the interface ☺
You’ve understood right, the steering wheel, foot throttle, gearbox, climate control equipment, and even your favorite car stereo are parts of the interface, which is provided to the driver to manage all this complexity.
Interfaces are quite common in our life:
- A person operating some machine has various controls, buttons, a display and so on at his disposal,
- You switch the TV channels with remote control,
- You use voice dial in your smartphone,
- You play video games with a joystick,
- You play the piano, even so!
Taking into consideration the examples above, let’s try to find a definition of this notion.
Interface — is a border between two systems, which is a set of rules, methods, and restrictions regulating how the systems interact with each other.
If we continue with the automobile example, two systems can be identified: a man and a vehicle. The latter sets certain rules, which allow a man to operate it following the rules.
API and RESTful API
Having dealt with the basic component of the term, let’s continue to decipher the two remaining words — Application Programming. The name itself hints that the term belongs to the software sphere. If compared to the automobile, we can come to the conclusion that API stands for 2 systems and the rules. The systems, in this case, are programming modules, web services and so on.
In fact, we could have finished with API at this point, but not to mention RESTfull API will be wrong. The matter is that API describes a phenomenon. The RESTfull API (or simply the REST API) in its turn is one of the approaches to implementing API for mobile application development.
It’s essential to understand this since API is often used in the communication for short, but it’s supposed to be realized by means of RESTfull API.
The answer to the main question
Having armed with knowledge about what an interface is and even having touched a bit a more narrowly specialized term RESTfull API, we can easily answer the main question «Why does a mobile app need API?»
Let’s start with «anatomy». A mobile application consists not only of the visual part — UI- user interface, but a number of questions should be solved in the course of mobile development. They are like these: where to store the information about the users, messages, orders, etc.
The solution should also have certain functions, like accepting payments, authorize the user, send SMS during the registration or PUSH notifications when an event occurs.
There are plenty of tasks, but which one (or maybe all of them) is the reason to create API for a mobile app? The answer is: none. It can all be realized without an API within a single smartphone.
In fact, the major cause is the multi-user nature of a mobile app. As soon as more than one user appears, the problem of data sharing sets in.
Imagine a situation when a user changes his name. If the data were stored only on his smartphone, another user would not be able to know about the change.
Except for data sharing, there are other problems: what should be done if the smartphone is lost or reset, and how to cope with hundreds of devices’ support?
All these problems are solved through the business logic centralization and to access it API is designed (to be more precise — RESTfull API as we know already).
One more case when you can’t do without API is when you want to provide your clients with access to your data or functions for a fee.
SMS aggregators can also be taken as an example; their main function is to send SMS. The developer, in this case, do not need to delve into the whole complexity of mobile networks, but all he needs to do is to integrate an app with an SMS integrator and to call the necessary API for sending.
Taking into consideration everything described above we can come to the key conclusion: to perform its functions a mobile app turns to the external server, which centralizes the whole business logic (it’s also called Backend).
API is necessary to access the server, meaning a certain set of rules is needed, which will allow the client, the app, to be precise, access it.
Practically, it looks like this: you want to make an order, for instance, your iOS or Android app will then send a command to the server with the help of API to create an order. The server will fulfil the request and save all the info into the database, thus the information about the order will be available to the other users.
Hope this article will help you sift the question of API to the bottom once and forever.
All the best :)