What is the difference between API and web services?

33,571

Solution 1

A web service is just an API in HTTP clothing.

Solution 2

A web service is something delivered over the Internet for direct use by another computer (rather than a human).

An API is an Application Programming Interface. A website application might expose an API thorugh a web service. However, desktop applications like Excel or Word have APIs which have nothing to do with the web (they have VBA and COM based APIs).

Simlarly, a server application (eg. Joomla) might have a PHP based API that is used from withinthe server - ie. no web service necessarily involved.

Solution 3

  1. Web Service is an API wrapped in HTTP.
  2. All Web Services are API but APIs are not Web Services.
  3. Web Service might not perform all the operations that an API would perform.
  4. A Web Service needs a network while an API doesn't need a network for its operation.

Solution 4

All web services are APIs, but not all APIs are web services. One is a subset of the other.

Solution 5

An API doesn't need to be web based.

Web Services may also may not perform all of the operations one would expect from a full API.

Share:
33,571
krunal shah
Author by

krunal shah

CTO at @Thirdrocktechno @Quick_Capture

Updated on April 20, 2020

Comments

  • krunal shah
    krunal shah about 4 years

    As per my knowledge api and web services are used to fetch data from other websites.

    So what's difference between them ?

    Any Help!

    EDIT

    Can somebody please explain it with proper example ?

    What is twitter and facebook api ? Can we say it's just a function or webservices to access their data.

  • André Caron
    André Caron over 13 years
    Isn't a web service programming language agnostic and an API an embodiment of the web service as a library to facilitate use of the web service?
  • Justin Niessner
    Justin Niessner over 13 years
    @Andre - Web Services are typically language agnostic (unless they use platform specific binary serialization) but you can use them to create a language agnostic API as well.
  • Admin
    Admin over 13 years
    So then a Web-Service is an API? (A defined programming interface specific to a given service, or application.) Consider something like Project Server, or SharePoint, which allow pretty much full control over their respective models through their web-services.