Differences between API and Web Service
Web services and APIs are two of those overlapping tech terms that regularly get confused. You might have even heard these words used interchangeably, but are they even the same thing?
While they do have some overlap, web services and APIs are two different concepts.. API and Web service serve as a means of communication. The only difference is that a Web service facilitates interaction between two machines over a network. An API acts as an interface between two different applications so that they can communicate with each other.
|Point of Distinction||API||Web Service|
|Definition||An API, or Application Programming Interface, is a set of definitions and protocols that allow one application to communicate with another application.||As described by the World Wide Web Consortium (W3C), Web services provide a standard means of interoperating between different software applications, running on a variety of platforms and/or frameworks. A web server running on a computer listens for requests from other computers. When a request from another computer is received, over a network, the Web service returns the requested resources. This resource could be JSON, XML, an HTML file, Images, Audio Files, etc.|
|Need of Network||Not Always. APIs can be online or offline||Always Need|
|Type||All APIs are not web service.||All Web Services are API.|
|Light Weight Architecture||It is light weight architecture and good for devices which have limited bandwidth, like mobile devices.||It require SOAP protocol to send and receive data over the network so it is not light weight architecture.|
|Style of Communication||Any style of communication.||Use only 3 style: SOAP, REST, XML-RPC|
|Protocol||It supports the HTTP protocol: URL, Request/Response Headers, caching, versioning, content formats.||It only supports the HTTP protocol.|
|Hosted on IIS||It can be hosted on application or within IIS.||It can only be hosted on IIS (Internet Information Services) Server.|
|Open Source||It is open source and can be used by client that understand XML or JSON. Many public APIs are transparent, with open documentation and self-service portals for quick developer on-boarding.||It is not open source but can be used by any client that understand XML. They tend to offer specific data and/or functionality to specific partners.|