You might have heard people talking about something called an API which stands for Application Programming Interface. This article explains what is an API , types of api architecture, and how does api work with example in the real world.
Contents :
What is an API ?
API is the acronym for Application Programming Interface, which is a software program that allows two applications to talk to each other (mainly for exchanging data).
How Does API Work Example

To learn more about what is an api and how does it work, let's start by describing a very basic example. For this situation we have one client application which is also going to be a website--now said website wants to include an authentication method for some pages on their site.
There are two ways to implement authentication mechanism which are as follows :
Our goal is to understand how does API Works, So we will consider the Method - II
Google Sign-in API provides a unique key to each website, which allows Google to track any unauthorized actions made by our client application.
Now, let us understand how Google SignIn API fulfilling our requirement. Firstly, Our website will trigger the google SignIn API with a unique key that was assigned to it, Now google SignIn API will check whether the request is valid or not if it is valid then it will accept the request and interact with the Google database and then send a response back to our website i.e., client_application.
REST API :
REST, which stands for representational state transfer, has become an increasingly popular way to develop web APIs these days. REST is scalable, lightweight, and easy to use – three features that make it great for creating an API.
The following are some of the guidelines which are followed when transferring data between a server and its requestor (client)
By following these guidelines, REST APIs can be used for quick, easy, secure data transfers, making them a popular choice among developers.
SOAP :
- SOAP stands for Simple Object Access Protocol which is used for transmitting data across networks.
- SOAP is standardized by the World Wide Web Consortium (W3C) and utilizes XML to encode information.
- SOAP strictly defines how messages should be sent and what must be included in them. This makes SOAP APIs more secure than REST APIs.
- For this reason, SOAP is used internally for data transfers that require high security and one more advantage of SOAP is that it works over any communication protocol (not just HTTP, as is the case with REST).
RPC :
- RPC stands for Remote Procedural Call
- RPC protocol is the most straightforward of the three architectures. Unlike REST and SOAP which facilitate the transfer of data, RPC APIs invoke processes. In other words, they execute scripts on a server.
RPC APIs can handle either JSON (a JSON-RPC protocol) or XML (an XML-RPC protocol) in their calls. XML is more secure than JSON, Though the RPC protocol is strict, it’s a relatively simple and easy way to execute code on remote networks
If you have any questions or suggestions, please feel free to leave a comment below.