About API and Web Services
What is an API?
API stands for Application Programming Interface.
It is a software interface that allows two distinct services/applications to interact without one having to know the implementation details of the other. It is what we call, protocol agnostic.
What is a web service?
A web service is a medium that lets two machines communicate with each other over a network.
In other words, it allows communication between the client and the server applications using the XML, JSON, and other plain text open standards over the World Wide Web (WWW).
The W3C defined a web service as:
A web service is a software system designed to support interoperable machine-to-machine interaction over a network. It has an interface described in a machine-processable format (specifically WSDL). Other systems interact with the web service in a manner prescribed by its description using SOAP messages, typically conveyed using HTTP with an XML serialization in conjunction with other web-related standards.
Types of web services
There are two main types of web services:
SOAP web services – SOAP which stands for Simple Object Access Protocol, is a specification that enables applications to communicate with other applications. It uses an XML-based protocol to access web services over
RESTful web services – REST which stands for Representational State Transfer, is a service developed on the REST architecture and is often called a RESTful service. They are lightweight, maintainable, and scalable in nature. The underlying protocol for REST is
API vs web services
|Not all APIs are web services
|All web services are APIs
|APIs can use any style for communication
|A web service can use SOAP, REST, and XML-RPC for communication
|APIs can also be used to invoke functions within a software, so it does not always need a network for its operation
|A web service will always need a network for its operation
SOAP vs REST
Please refer to this SOAP Vs REST article to understand the differences between them.