web服务和API之间的区别是什么?差异是否超过了传输数据所使用的协议? 谢谢。
当前回答
API是基于代码的集成,而web服务是基于消息的集成,与具有WSDL等契约的可互操作标准进行集成。
其他回答
基本上,webservice是两台机器之间的一种通信方法,而API是一个公开的层,允许你对某些东西进行编程。
你可以有一个API,而与该API交互的主要方法是通过web服务。
技术定义(维基百科提供)是:
API
应用程序编程接口(API)是库和/或操作系统服务提供的一组例程、数据结构、对象类和/或协议,以支持应用程序的构建。
网络服务
Web服务(也称为Web服务)被W3C定义为“一种旨在支持网络上可互操作的机器对机器交互的软件系统”。
API是基于代码的集成,而web服务是基于消息的集成,与具有WSDL等契约的可互操作标准进行集成。
把Web服务看作Web api。API现在是一个通用术语,因此web服务是功能的接口,通常与业务相关,您可以通过各种协议从网络获得它。
一般来说,web服务是一个基于HTTP的API。它们通常使用JSON或XML,但也有一些其他方法。
API(应用程序编程接口),完整的形式本身表明它是一个接口,允许你在其他应用程序接口的帮助或支持下为你的应用程序编程,它公开了一些对你的应用程序有用的功能。
E.g showing updated currency exchange rates on your website would need some third party Interface to program against unless you plan to have your own database with currency rates and regular updates to the same. This set of functionality is when already available with some one else and when they want to share it with others they have to have an endpoint to communicate with the others who are interested in such interactions so they deploy it on web by the means of web-services. This end point is nothing but interface of their application which you can program against hence API.