描述 REST 服务
如何描述生成 JSON 响应的非常简单的 REST 服务的最标准化形式是什么? WSDL 对于 XML 来说有点像(但在这里 WSDL 显然是一种杀伤力,不推荐)。
What is the most standardized form how to describe a very simple REST service producing JSON responses? Something what WSDL is for XML (but here WSDL would be an obvious overkill and not recommended).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
来自 REST 服务的响应应该是自描述的,因此拥有单独的描述文档是多余的。
Responses from a REST service should be self-describing so having a separate description document would be redundant.
我认为没有。 REST 缺乏 WSDL 风格的服务描述,这要么是一个特性(根据 REST 爱好者的说法,更加简单),要么是一个主要缺点(根据 SOAP 爱好者的说法)。
I don't think there is one. REST's lack of a WSDL-style service description is either a feature (greater simplicity, according to REST enthusiasts) or a major shortcoming (according to SOAP fans).
我知道的最接近的等效项是 WADL
The nearest equivalent I'm aware of is WADL
我看到这篇博文,它基本上建议使用 JSON 来描述 RESTful 服务。认为这是一个绝妙的主意并在这里分享: http://ttezel.github.com/blog/2013/02/23/stop-writing-rest-api-clients/
I came across this blog post which basically proposes using JSON for describing RESTful services. Thought its a brilliant idea and sharing it here: http://ttezel.github.com/blog/2013/02/23/stop-writing-rest-api-clients/