1. API
API stands for Application Programming Interface.
It’s a software interface that allows two or more applications to interact with each other without any user intervention.
It offers products or services to communicate with other products and services without having to know how they’re implemented.
Protocols that can be used in APIs are TCP, SMTP, HTTP
.
1.2 Why would we need an API?
- API produces
efficient,quicker, and morereliableresults Better integration- Platform and Website independent- Automation, Flexible delivery of services, Adding New functionality
1.3 Types of APIs based on scope of use
- Private APIs
- These are
internal to an enterpriseand only used for connecting systems and data within the business.
- These are
- Public APIs
- These are
open to the publicand may be used by anyone. - There may or not be some authorization and cost associated with these types of APIs.
- Eg: Google API, Facebook API etc
- These are
- Partner APIs
- These are only accessible by
authorized external developersto aid business-to-business partnerships. - Eg: Whatsapp business API
- These are only accessible by
- Composite APIs
- These
combine two or more different APIsto address complex system requirements or behaviors.
- These
1.4 Types of APIs based on architecture
API architecture is usually explained in terms of client and server.
- The application
sending the requestis called the client, - The application
sending the responseis called the server.
There are four different ways that APIs can work depending on when and why they were created.
SOAP APIs
- These APIs use
Simple Object Access Protocol. - Client and server exchange messages
using XML. - This is a less flexible API that was more
popular in the past. - Protocol Used: TCP or SMTP
More securethan REST API- Preferred Choice:
Offline application
RPC APIs
- These APIs are called
Remote Procedure Calls. - As name suggest it invokes remote
function/processesorexecute scriptson a server - RPC
only supports GET and POSTrequests. - RPC is
not well standardized
What is RPC? gRPC Introduction.
Websocket APIs
- Websocket API is another modern web API development that uses JSON objects to pass data.
- A WebSocket API supports
two-way communicationbetween client apps and the server. - The server can send callback messages to connected clients, making it more efficient than REST API.
REST APIs
- It is most
Popular,Simple,Scalableandflexible. - Protocol Used: HTTP
- Data Transfer:
JSON Less securethan SOAP API- Preferred Choice: Web based application
1.5 WEB API
A Web API is subset of API, that provides a platform-independent interface
that can be used by various client like mobile, web and desktop applications
- It includes - REST, SOAP, XML-RPC.
- All web services are APIs but
not all APIs are web services.