javascript - Google 的自定义搜索 API 是 SOA 的一个示例,不是 Restful

标签 javascript rest soa

http://en.wikipedia.org/wiki/HATEOAS :

HATEOAS, an abbreviation for Hypermedia as the Engine of Application State, is a constraint of the REST application architecture that distinguishes it from most other network application architectures. The principle is that a client interacts with a network application entirely through hypermedia provided dynamically by application servers. A REST client needs no prior knowledge about how to interact with any particular application or server beyond a generic understanding of hypermedia. Contrast this with e.g. a service-oriented architecture (SOA), where clients and servers interact through a fixed interface shared through documentation or an interface description language (IDL).

http://kinderman.net/2010/06/23/approaching-pure-rest-learning-to-love-hateoas :

The Twitter API, for example, has services that allow clients to update their status, or retweet one that already exists. Twitter's API is not RESTful, so the documentation for retweeting a status instructs developers to call the service by sending an HTTP POST or PUT request to http://api.twitter.com/1/statuses/retweet/[id].[format].

If the Twitter API were RESTful, clients would need to understand what it means to follow a link to retweet a status. The semantics of such a service are deeper than what Fielding talks about in his comment about browsers and crawlers.

http://code.google.com/apis/customsearch/v1/using_rest.html :

You can retrieve results for a particular search by sending an HTTP GET request to its URI. The URI for a search has the following format:

https://www.googleapis.com/customsearch/v1?parameters

因此 Google 的自定义搜索 API 是 SOA 的一个示例,而不是 Restful。

对/错??

拜托,这是一个明确的问题。为什么有人在 12 小时后无法回答。一个清楚说明为什么不能回答的答案仍然是一个答案。

最佳答案

如果有人构建了一个硬编码 https://www.googleapis.com/customsearch/v1?parameters URL 的客户端,那么他们就没有以 REST 方式使用该服务。如果 google 不提供可从服务条目 URL 发现的资源,其中包含此搜索 URI 的 URI 模板,则在使用此 API 时不可能完全 RESTful。

关于javascript - Google 的自定义搜索 API 是 SOA 的一个示例,不是 Restful,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6676973/

相关文章:

javascript - 如何控制页面加载工作流程

javascript - 创建格式正确的数据

ruby-on-rails - Ruby on Rails REST设计题——账户间转账

deployment - 每个微服务都应该在自己的进程中运行吗?

sql - Oracle SOA 查询需要通配符

soa - API 与微服务中的事件方法

javascript - 为什么关键帧在 Firefox 上有效,但在 Chrome 上无效?

javascript - jquery、javascript - 如何从变量中删除此参数

java - 安全地向 RESTFUL API 提供凭据

java - REST API - 无法使用 JAXB 转换 XML