API and Web Services
The API and Web Services both are used for the communication from one software system to another software system. Web service can communicate between two system through internet only where as API can also communicate between two system which are not using internet.
i.e. All the Web Services are APIs but all the APIs are not the Web Services.
What is the Web Service?
Web Service is a medium of communication between the client and server on the internet.
It is a XML-based data exchange systems that use the web for direct application-to-application interaction. These systems will embrace programs, objects, messages, or documents.
It is a chunk of a software package that creates itself obtainable over the web and uses the same XML electronic communication system.
It is a set of open protocols and standards used for exchanging information between applications or systems. Package applications written in numerous programming languages and running on numerous platforms will use internet services to exchange information over computer networks just like the web during a manner kind of like inter-process communication on one computer. This ability (e.g., between Java and Python, or Windows and UNIX system applications) is because of the utilization of open standards.
*XML stands for Extensible Markup Language, It is a self –descriptive and designed to store & transport data.
What is an API?
API (Application Programming Interface) is a set of codes, protocols, procedures which create a connection to flow the data between Application and Server according to the HTTP Request and Responses.
Difference between API and Web Services:
Web Service and API are both used for communication but the difference is that Web Service almost always involves communication over network and HTTP is the most commonly used protocol. Web service also uses SOAP, REST, and XML-RPC (Remote Procedure Call) as a means of communication. All Web Services are API but APIs are not Web Services.