API和web服务的区别是什么?

时间:2022-10-22 09:06:53

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

根据我的知识,api和web服务用于从其他网站获取数据。

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.

什么是twitter和facebook api ?我们可以说它只是一个函数或web服务来访问它们的数据。

10 个解决方案

#1


19  

A web service is just an API in HTTP clothing.

web服务只是HTTP服装中的API。

#2


11  

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

web服务是通过Internet交付给另一台计算机(而不是人)直接使用的东西。

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).

API是应用程序编程接口。一个网站应用程序可能会暴露一个API thorugh一个web服务。然而,像Excel或Word这样的桌面应用程序有与web无关的api(它们有基于VBA和COM的api)。

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

服务器应用程序(如Simlarly)。Joomla)可能有一个基于PHP的API,可以从服务器上使用。不需要web服务。

#3


7  

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

所有的web服务都是api,但并非所有的api都是web服务。一个是另一个的子集。

#4


6  

An API doesn't need to be web based.

API不需要基于web。

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

Web服务也可能不能执行完整API所期望的所有操作。

#5


6  

API (application programming interface) is a list of methods and classes exposed by a programmer to use by other programmers, so eg if you use Twitter or Facebook API in your programs, you can make it cooperate with Twitter and Facebook, and do many useful things. :-)

API(应用程序编程接口)是程序员公开供其他程序员使用的方法和类的列表,例如,如果您在程序中使用Twitter或Facebook API,您可以使它与Twitter和Facebook合作,并做许多有用的事情。:-)

There are many ways of exposing APIs (JAR files or RMI in Java, .net Assemblies, COM objects, DLL and .H files in C/C++, JSON over HTTP, XML over HTTP, many home-made methods).

有许多方法可以公开api (Java中的JAR文件或RMI, .net程序集,COM对象,C/ c++中的DLL和. h文件,HTTP中的JSON, HTTP中的XML,许多自制的方法)。

Web Services are just yet another way of exposing API, in this case the actual execution of the exposed methods is done not on your computer, but on some other computer on the Internet (on the Web - hence name "WebServices").

Web服务只是另一种公开API的方式,在这种情况下,公开的方法的实际执行不是在您的计算机上,而是在Internet上的其他计算机上(在Web上,因此称为“WebServices”)。

#6


6  

  1. Web Service is an API wrapped in HTTP.
  2. Web服务是包装在HTTP中的API。
  3. All Web Services are API but APIs are not Web Services.
  4. 所有的Web服务都是API,但是API不是Web服务。
  5. Web Service might not perform all the operations that an API would perform.
  6. Web服务可能不会执行API将要执行的所有操作。
  7. A Web Service needs a network while an API doesn't need a network for its operation.
  8. Web服务需要网络,而API不需要网络来进行操作。

#7


4  

A web service can be thought of as a type of API. But for the moment, you should forget that, and just concentrate on learning what an API actually is; a precise definition of methods for interacting with a piece of software. Sometimes, this involved sending data over a network, but usually we're talking about functions that may be called from a program.

web服务可以被认为是一种API。但是现在,你应该忘记这一点,集中精力学习什么是API;与软件块交互的方法的精确定义。有时,这涉及到通过网络发送数据,但通常我们谈论的是可能从程序调用的函数。

For example, there's a function called FileUtils.rm in Ruby. This is the API; when you're calling the function from a Ruby script, it always looks the same. Then there's the implementation of the API; that's the code that actually removes the file - it might look completely different in every implementation of Ruby, but you (normally) don't care about that, since you're only dealing with the Ruby API.

例如,有一个名为FileUtils的函数。rm在Ruby中。这是API;当您从Ruby脚本调用函数时,它看起来总是一样的。然后是API的实现;这是实际删除文件的代码—在Ruby的每个实现中,它看起来可能完全不同,但是您(通常)并不关心这个,因为您只处理Ruby API。

#8


3  

Webservices available over internet.you can get information without actually having the classes or know how it works using http and soap protocols.

web服务在互联网上提供。您可以在没有类的情况下获取信息,或者不知道它是如何使用http和soap协议的。

API is a kind of library (set of classes), you can use the functions available in that to perform some action in your application.

API是一种库(类集),您可以使用其中的函数在应用程序中执行一些操作。

#9


2  

Check out the wikipedia entry on web API's at http://en.wikipedia.org/wiki/Api#Web_APIs.

在http://en.wikipedia.org/wiki/Api# web_api上查看wikipedia条目。

It's well written, though pretty much agrees with what the others here say.

这本书写得很好,尽管它和这里的其他人说的差不多。

#10


2  

APIs exposed over web are Webservices

通过web公开的api是web服务

#1


19  

A web service is just an API in HTTP clothing.

web服务只是HTTP服装中的API。

#2


11  

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

web服务是通过Internet交付给另一台计算机(而不是人)直接使用的东西。

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).

API是应用程序编程接口。一个网站应用程序可能会暴露一个API thorugh一个web服务。然而,像Excel或Word这样的桌面应用程序有与web无关的api(它们有基于VBA和COM的api)。

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

服务器应用程序(如Simlarly)。Joomla)可能有一个基于PHP的API,可以从服务器上使用。不需要web服务。

#3


7  

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

所有的web服务都是api,但并非所有的api都是web服务。一个是另一个的子集。

#4


6  

An API doesn't need to be web based.

API不需要基于web。

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

Web服务也可能不能执行完整API所期望的所有操作。

#5


6  

API (application programming interface) is a list of methods and classes exposed by a programmer to use by other programmers, so eg if you use Twitter or Facebook API in your programs, you can make it cooperate with Twitter and Facebook, and do many useful things. :-)

API(应用程序编程接口)是程序员公开供其他程序员使用的方法和类的列表,例如,如果您在程序中使用Twitter或Facebook API,您可以使它与Twitter和Facebook合作,并做许多有用的事情。:-)

There are many ways of exposing APIs (JAR files or RMI in Java, .net Assemblies, COM objects, DLL and .H files in C/C++, JSON over HTTP, XML over HTTP, many home-made methods).

有许多方法可以公开api (Java中的JAR文件或RMI, .net程序集,COM对象,C/ c++中的DLL和. h文件,HTTP中的JSON, HTTP中的XML,许多自制的方法)。

Web Services are just yet another way of exposing API, in this case the actual execution of the exposed methods is done not on your computer, but on some other computer on the Internet (on the Web - hence name "WebServices").

Web服务只是另一种公开API的方式,在这种情况下,公开的方法的实际执行不是在您的计算机上,而是在Internet上的其他计算机上(在Web上,因此称为“WebServices”)。

#6


6  

  1. Web Service is an API wrapped in HTTP.
  2. Web服务是包装在HTTP中的API。
  3. All Web Services are API but APIs are not Web Services.
  4. 所有的Web服务都是API,但是API不是Web服务。
  5. Web Service might not perform all the operations that an API would perform.
  6. Web服务可能不会执行API将要执行的所有操作。
  7. A Web Service needs a network while an API doesn't need a network for its operation.
  8. Web服务需要网络,而API不需要网络来进行操作。

#7


4  

A web service can be thought of as a type of API. But for the moment, you should forget that, and just concentrate on learning what an API actually is; a precise definition of methods for interacting with a piece of software. Sometimes, this involved sending data over a network, but usually we're talking about functions that may be called from a program.

web服务可以被认为是一种API。但是现在,你应该忘记这一点,集中精力学习什么是API;与软件块交互的方法的精确定义。有时,这涉及到通过网络发送数据,但通常我们谈论的是可能从程序调用的函数。

For example, there's a function called FileUtils.rm in Ruby. This is the API; when you're calling the function from a Ruby script, it always looks the same. Then there's the implementation of the API; that's the code that actually removes the file - it might look completely different in every implementation of Ruby, but you (normally) don't care about that, since you're only dealing with the Ruby API.

例如,有一个名为FileUtils的函数。rm在Ruby中。这是API;当您从Ruby脚本调用函数时,它看起来总是一样的。然后是API的实现;这是实际删除文件的代码—在Ruby的每个实现中,它看起来可能完全不同,但是您(通常)并不关心这个,因为您只处理Ruby API。

#8


3  

Webservices available over internet.you can get information without actually having the classes or know how it works using http and soap protocols.

web服务在互联网上提供。您可以在没有类的情况下获取信息,或者不知道它是如何使用http和soap协议的。

API is a kind of library (set of classes), you can use the functions available in that to perform some action in your application.

API是一种库(类集),您可以使用其中的函数在应用程序中执行一些操作。

#9


2  

Check out the wikipedia entry on web API's at http://en.wikipedia.org/wiki/Api#Web_APIs.

在http://en.wikipedia.org/wiki/Api# web_api上查看wikipedia条目。

It's well written, though pretty much agrees with what the others here say.

这本书写得很好,尽管它和这里的其他人说的差不多。

#10


2  

APIs exposed over web are Webservices

通过web公开的api是web服务