RESTful Web Service usage of custom link relations - 'rel'

允我心安 提交于 2019-12-09 17:30:14

问题


I'm working on a RESTful service and have been focusing on Discoverability, Link relations - 'rel' and microformats. I'm not clear about the values of 'rel' in the context of REST - am I allowed to make use of any custom value, to provide richer semantics or should I only use the default values (which are very constraining)?

I am aware that microformats have indeed extended the values of 'rel', but I am not using any kind of microformat yet.

Any help is appreciated. Thanks.


回答1:


Link Relations (rel) are one of the two ways that you can convey semantics to a client. The other way is media types.

The best spec to read on Web linking is here http://tools.ietf.org/html/rfc5988.

The link relation registry is here http://www.iana.org/assignments/link-relations/link-relations.xml.

And for an example of how to use link relations to convey semantics you can look a the Hal media type. It is a generic media type that uses link relations to convey all of its semantic meaning. http://stateless.co/hal_specification.html



来源:https://stackoverflow.com/questions/8026275/restful-web-service-usage-of-custom-link-relations-rel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!