4

I have searched a lot upon internet but still i didn't get the clear difference between web services and web APIs? Somewhere I read that all web services are API's but all API' are not web services. How?

What all I know is both allow to utilize the functionality of other applications.Can someone describe me clear difference?

Hussain Rauf
  • 278
  • 2
  • 15
  • 1
    service = the company, api = the specific way you interface with the company. e.g. if your service is mcdonald's, then the api is walking up the register and ordering a bigmac. – Marc B Jul 03 '15 at 15:48
  • Do you mean Microsoft's WebApi or just Rest Api? – Frankely Diaz Jul 03 '15 at 15:48

3 Answers3

3

I have been on the same journey to learn the differnce between Web API (not JUST API) vs Web Services.

First, we know for a fact that both use the Web as the communication tool as stated by @Kris.

While looking at these 2 videos, both serve as the "middleman" (the waiter in the restaurant) for a client to ask a Web Server to process and deliver a response.

When I was looking for an actual differnce between the two, usually most articles and videos go on an unrelated comparison between "Web Services vs API" as they exclude the "Web" out of "Web API". See this article, for example, which contains the title "Web API Vs Web Service...." yet, contain sub-titles like:

  • "Differences of API vs Web Service"
  • "Pros and Cons of Web Services vs API Service"
  • "Web Service vs API: Fueling Both With Scraping Robot’s API"

The only difference I could find is if we were to discuss this in .NET context. Here's a question post related to this.

To sum it up, Web Services are used in the SOAP protocal while Web API is usually created in the RESTful way. The more detailed answers are in the post but ultimatelly do not answer the main question that is asked.

Conclusion: The question raised in the public domanin has no clear definition to what is difference between the two, thus the 2 terms are ,for the most part, interchangeable

taz mazia
  • 182
  • 10
1

All web services are APIs. An API is an Application Programming Interface. But there are offline APIs, which are not web services. There are APIs for all things from Office to Websites. The API is just a defined interface to be able to control/communicate with some software. Web Services just provide that means of connecting over the web.

There is more to discuss when you are talking about APIs which are communication protocols and data formats, but you get the basic idea.

MiltoxBeyond
  • 2,683
  • 1
  • 13
  • 12
0

An API (Application Program Interface) is the interface through which another program can communicate with a program.

A web service in this context is one of those programs with an API. 'Web' means that it is accessible via the web, mostly via HTTP. A service usually has a well defined purpose.

For instance a date web service's purpose could be to provide the current date. The API of my service would have a single 'endpoint': get the date. The service then implements this API. It somehow retrieves the date and sends it back.

Kris
  • 4,595
  • 7
  • 32
  • 50
  • Are API's gateway to access the web service? I mean web services are logical applications and API's are way to reach to web services? Am I right? – Hussain Rauf Jul 03 '15 at 17:29
  • Yes, web services are applications that run on a server and wait for requests. The API defines the way you can communicate with the web service. I wouldn't call it gateway because this term is already used in a different context in IT. – Kris Jul 03 '15 at 18:36
  • Thank you kris. I have one more question. Sorry I am asking too many questions. I also read web services need network for its operation where as an API doesn't. In order to access the web services we need to be on a network like internet but for API we don't. Why for API we don't need to be on a network? – Hussain Rauf Jul 03 '15 at 18:54
  • API is a very general term. An API can be an interface for any kind of program (or part of a program) including a web service. If it is for a web service then the web service needs to be connected to the internet. If an API provides an interface to other programs or other parts of the same program there doesn't have to be a network involved - the connection can be provided e.g. by the OS. – Kris Jul 03 '15 at 19:20
  • I don't know the API of the Office suite. But I'd guess yes. – Kris Jul 03 '15 at 21:54