What is an API ?
Nowadays we use the term API so often. I meet lots of people, both working in tech and elsewhere, who have a rather vague or incorrect idea about what this fairly common term means.
An Application Programming Interface (API) is a particular set of rules (‘code’) and specifications that programs can follow to communicate with each other. APIs are growing exponentially every year.
The world of software moves fast. In earlier days data entered and processed in the same system, but now the origin of the data and processing place is entirely different. We should be able to access the data from anywhere at any time, that’s why we store this data in cloud storage.
For sending and receiving data from/to the server,we want a middle man who is platform independent.That middleman handles the requests and serves the response to the user.The below diagram illustrates this better than words.
The End user sends a request , API executes the instruction then get the data from the server and respond to the user.
Think about it this way:
You are at a restaurant and you want to eat something , place your order to the waiter he conveys the order to the kitchen and serves it to you once it ready. Here the waiter is ACT as an API.Customer may change but the waiter serves them in the same manner. The following diagram explains it simply.
Types of API :
What are web APIs ?
It is used for exchanging information with a website, either by receiving or by sending data. A web API typically consists of multiple publicly exposed endpoints that accept HTTP requests and respond with the requested data, typically in the form of JSON or XML.
API call in Android ?
Performing API call in Android is a little bit difficult because first, you need to check the internet connection. If it’s available then only you can make a request. And you need to handle the cache also.
To simplify these operations several popular Open Source libraries are available. The most popular ones are the following:
These deserve a separate blog post themselves. I’m planning to write one soon. Keep watching this space for updates.
Latest posts by Jaison Fernando (see all)
- How to create face detector using Firebase MLKit? - November 29, 2018
- How to create a barcode scanner using Firebase MLKit? - November 9, 2018
- How to update your app using Firebase Remote Config? - October 20, 2018