What is the difference between API and web services?
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
- Web Service is an API wrapped in HTTP.
- All Web Services are API but APIs are not Web Services.
- Web Service might not perform all the operations that an API would perform.
- 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.
Comments
-
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 over 13 yearsIsn'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 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 over 13 yearsSo 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.