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 more reliable results
  • 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 enterprise and only used for connecting systems and data within the business.
  • Public APIs
    • These are open to the public and 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
  • Partner APIs
    • These are only accessible by authorized external developers to aid business-to-business partnerships.
    • Eg: Whatsapp business API
  • Composite APIs
    • These combine two or more different APIs to address complex system requirements or behaviors.

1.4 Types of APIs based on architecture

API architecture is usually explained in terms of client and server.

  • The application sending the request is called the client,
  • The application sending the response is 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 secure than REST API
  • Preferred Choice: Offline application

RPC APIs

  • These APIs are called Remote Procedure Calls.
  • As name suggest it invokes remote function/processes or execute scripts on a server
  • RPC only supports GET and POST requests.
  • 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 communication between 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, Scalable and flexible.
  • Protocol Used: HTTP
  • Data Transfer: JSON
  • Less secure than 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.

1.6 What Is GraphQL? REST vs. GraphQL

Reference