APIs (Application Programming Interface(s)) allow us to transfer(or fetch) the data from one application to another application of our choice.
Why do we need APIs?
We need APIs to transfer the data among different applications. Moreover APIs allow us to have a standardized system (set of protocols) through which multiple applications can communicate with the desired single application in the “develop once use multiple times” fashion. APIs are needed to perform a dedicated task by allowing us to connect useful applications together. APIs act as the middle-man and kinda transport data among different applications.
What is an API?
API is an acronym for Application Programming Interface that is designed to perform a particular task by using procedure (or routine) , making use of dedicated protocols that decides the format for communication and finally make use of tools that allow the creation of new programs.
Application: Application is a software that provides solutions to the real-world problems, entertainment and infotainment.
Programming: The process of writing a set of instructions to perform a certain task called programming.
Interface: It is how your software will interact with the other applications (usually the one you want to fetch the data from).
APIs working principle:
APIs work on the principle of providing an interface between different applications that allows your application (the application you are using or developing) to connect and fetch data from another application making use of protocols (format) used by that application. For example: Suppose you are planning your birthday party and you want to order food and sweets online from your favorite restaurant on your favorite platform (eg. Zomato, Swiggy, Dunzo, Ola eats etc) so if you are not already registered on your favorite platform then you first need to register there, you can use your contact details to register, otherwise you can register with the help of your social account like Facebook (now meta), Google, Apple etc and your basic details like name etc. will be automatically fetched using the API of social platform you just used (Facebook (now Meta) , Google etc.) . I think now you have got the basic idea on how APIs work but let’s continue with our example to understand it better. So now you have added the food into your cart and let’s assume you are paying for it online, so you need to select your payment-type, and after selecting it you will be redirected to the payment-gateway website. You will need to fill your UPI/banking details over there (making use of other application like banking website etc through APIs), and after completion of payment, you will be redirected back to whatever food ordering platform you are using. So I hope now you have more clarity and understanding on how APIs work.
Classification of APIs:
REST APIs: REST stands for Representational State Transfer. REST APIs have been designed by developers and mostly used by developers to send requests and receive responses through HTTP(S). There are four different types of requests named GET, PUT, POST, and DELETE that are made use of by programmers.
SOAP is an acronym for Simple Object Access Protocol. SOAP is a standard protocol. SOAP is based on systems that employ XML, thus having larger, more expensive data. SOAP APIs also provide a higher level of security compared to REST APIs. Financial institutions like banks use these APIs.
RPC stands for Remote Procedure Call. RPC APIs are designed to run the programs (usually web apps) on a different server. Since they are mainly used for web apps that employ HTTP(S) hence in such scenarios, they are called web APIs.
API Management: APIs after creation indeed needs management, it is not like once the APIs have been created and then no need to do anything. As protocols and policies get changed the need for updating the APIs emerges. Sometimes new fields get added as new data come into the market or the need of that particular field(s) emerges. For example if you trade in cryptocurrencies and the website or exchange uses some API (eg CoinGecko) so you will be able to see the list of cryptocurrencies that are available. Now let’s assume a new coin or token named “Vaibhav” arrives in the market. So API owner (CoinGecko etc.) need to change their API accordingly so that “Vaibhav” coin or token will also reflect onto the exchange or website you are using. Now let’s take an example of “XRP”, after the SEC filed a lawsuit against it, some of the major crypto-exchanges stopped listing it on their platform so in this case they just deleted that particular coin from the API that they were using and updated the API accordingly. Similar is the case when some new policies are out there, so the API would need updation.
- API helps one application to communicate with the other application.
- API can be private (require an access key) or public (won’t require any access key only url is enough)
- API makes life easier for the programmers as they won’t have to write anything from scratch (or require source) to connect their (or client’s) application with the desired application.
- APIs work on design and develop once and use many times philosophy
- There are three types of APIs: REST, SOAP and RPC (web)
- APIs require maintenance and management (however very less, but still needed). Some well known scenarios are updation of data and change in T&Cs.