Tuesday, November 28, 2017

API, Web Service & Micro service - Acknowledging their uniqueness

I have seen people using the words APIs, Web Services and Micros services almost synonymously. Collating some ready-reference to acknowledge their differences and uniqueness.

Happy reading & sharing!

API (Application Programming Interface), Web Service and Micro service all serves means of interaction or communication.

API
Web Service
Micro Services

API can be seen as an interface that facilitates the communication/interaction between two or more applications or programs

Web service facilitates the communication of applications over network.

Microservices is a specialization of an implementation approach for service-oriented architectures (SOA) used to build flexible, independently deployable software systems
API has several means of communication. It could be triggered by certain application events, server events or even by system interrupts.
Web services uses HTTP (most commonly used protocol), SOAP, REST and XML-RPC as means for communication
Micro services communicates through HTTP,REST,JSON
APIs are Specific to programming language and have predefined rules on how unit of codes would interact with each other
Web Service interacts over communication protocol (e.g. HTTP), independent of any dependencies of programming language.
Services communicate using either synchronous protocols such as HTTP/REST or asynchronous protocols such as AMQP (Advanced Message Queuing Protocol).
API specifically defines methods that is to be consumed by other application/program to interact or within the same application.
Web Service performs similar (bit limited) functionalities as APIs but used over a network or Web.
Web services are generally targeted to perform just one functionality over network/web.
Desktop applications like Word, Excel, PowerPoint mostly  uses APIs that doesn’t involve web service
When application is Web-based, it may involve using API wrapped around HTTP (which is nothing but a Web service)
Micro services are loosely coupled collaborating services that might be exposed through API gateways or directly over web using HTTP.
API does not need network to interact. The APIs can be exposed in a number of ways which include: COM objects, DLL and .H files in C/C++ programming language, JAR files or RMI in Java, XML over HTTP, JSON over HTTP, etc
Web service can interact only over network.
Micro services can interact only over network.
API is more close to application and facilitates the interaction directly with the applications
Web service doesn’t interface directly with application. Interface is only open for the methods and properties those are exposed through HTTP, SOAP, REST or XML RPCs
Same as Web services
All APIs are not Web services
All Web services are APIs.
Deep inside, Micro service is still API – however a granule one.
API can perform lot more operations than a typical Web service or Micro Service can perform
Web service might not be able to perform all the operations that API would perform

Typically faster in execution, however not scalable
Slower or at par in execution with API, scalable to certain level
Slower or at par in execution with API, has highest scalability
As APIs typically responsible for number of functionalities, that is, if API is down/corrupt or missing it can bring down entire application or major functionalities
If Web services are down, it will impact only certain functionalities. It will impact the application to minimum or moderate level
Depending upon the implementation, if microservices are down, it will impact very small functionality of the application. Application as a whole will remain intact.


No comments:

Post a Comment