RESTful Web Service usage of custom link relations

2019-04-06 22:23发布

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条回答
Summer. ? 凉城
2楼-- · 2019-04-06 23:03

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

查看更多
登录 后发表回答