Difference between API and web services

Difference between API and web services
API and web service both act as a means of communication, but there are certain differences between them.

What is API?

API (application programming interface) is a set of intermediate methods that allow two different software to interact and exchange data, without intervention from any user.

An API will include full specifications, making the user interaction and integration process most convenient.

And the API doesn't always need to be web-based.

Khác biệt giữa API và web service

What is web service?

Web service is a network-based resource and is merely an API wrapped in HTTP.

It includes HTTP/HTTPS open standards and protocols, used to link data between software - applications built from many different programming languages.

The web service model is built on basic foundation of XML HTTP, including:

  • SOAP: Is a simple object access protocol.
  • UDDI: Universal description, discovery and Intergration the global web service.
  • WSDL: A language that describes web services.

In addition, the interface design of the web service must also ensure that it is described in a format that the computer can handle.

To improve performance, web services can also be integrated with SOA.

Khác biệt giữa API và web service

Difference between API and web services

Similarity

Both the API and web services are accessible via HTTP/HTTPS, allowing the provider as well as the client to communicate back and forth.

Differences

APIWEB SERVICE
Is open source, works based on XML.Not open source and JSON/XML discoverable.
Every API is not a web service.Every web service is an API.
Use any standard during communication process.Using 03 main standards (SOAP, REST, XML-RPC) in the communication process.
Works even without network.Works only when network is available.
Hosted in the application or IIS.Hosted on IIS.
Suitable for devices with limited bandwidth.Quite heavy, need SOAP to send and receive network data.
Acts as an interface between two different applications so that they can interact.For interaction between two machines over the network.

Besides, sometimes the web service is not capable of performing all the actions of a complete API.

Khác biệt giữa API và web service