Amidamaru's avatar

What is the difference between a Web Service and API?

I want to get data from a backend that is using Laravel. I am using Angular 4 as the front-end.

Do you know the difference between a Web Service and API?

0 likes
7 replies
topvillas's avatar

A web service is a .... service delivered over the web.

The API is how you would interact with the web service.

shakti's avatar
shakti
Best Answer
Level 5

Basic difference between Web Services and Web APIs

Web Service:

  1. It is a SOAP based service and returns data as XML.

  2. It only supports the HTTP protocol.

  3. It can only be hosted on IIS.

  4. It is not open source, but can be used by any client that understands XML.

  5. It requires a SOAP protocol to receive and send data over the network, so it is not a light-weight architecture.

Web API:

  1. A Web API is a HTTP based service and returns JSON or XML data by default.

  2. It supports the HTTP protocol.

  3. It can be hosted within an application or IIS.

  4. It is open source and it can be used by any client that understands JSON or XML.

  5. It is light-weight architectured and good for devices which have limited bandwidth, like mobile devices.

J_shelfwood's avatar

@shakti I don't claim to know the exact differences between the two terms but it seems rather odd that a webservice is limited to:

-HTTP (no HTTPS then?) -IIS hosting

What do you mean by open source? As in publicly available for use or as in the code is publicly available to work on or use?

I might just misunderstand though.

shakti's avatar
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. 

An API is a method by which the third-party vendors can write programs that interface easily with other programs. A Web service is designed to have an interface that is depicted in a machine-processable format usually specified in Web Service Description Language (WSDL). Typically, “HTTP” is the most commonly used protocol for communication. Web service also uses SOAP, REST, and XML-RPC as a means of communication. API may use any means of communication to initiate interaction between applications. For example, the system calls are invoked using interrupts by the Linux kernel API.

An API exactly defines the methods for one software program to interact with the other. When this action involves sending data over a network, Web services come into the picture. An API generally involves calling functions from within a software program.

Hope it might clear your view more

J_shelfwood's avatar

Right, I see. In that case i interpreted your list wrongly. Thanks for clearing that up :)

Please or to participate in this conversation.