O'Reilly logo

RESTful Web Services Cookbook by Subbu Allamaraju

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

5.4. How to Assign Link Relation Types

Without meaningful semantics assigned to URIs in links, links by themselves are not very useful. A link relation type conveys the role or purpose of a link. Once clients and servers agree on the meaning of these types, clients can find and use URIs from links. It is essential that you assign very specific and meaningful relation types to links.

Problem

You want to know what relation type to use for a link.

Solution

The key purpose of a link relation type is to act as an identifier for the semantics associated with the link. There are two ways to assign a value for link relation types. When the purpose of a link matches one of the standard types described in Table 5-1, use that value. See Appendix E for a complete list of registered relation types. If none of the registered types match, define an extended link relation type using the following conventions:

  • Express the link relation type as a URI, such as http://www.example.org/rels/create-po.

  • Provide an informational resource as an HTML document at that URI, with the HTML document describing the semantics of the link relation type. Include details such as HTTP methods supported, representation formats supported for requests and responses, and business rules about using the link.

  • If the link relation type is meant for public use, register that link relation as per the process outlined in Section 6.2 of Web Linking Internet-Draft.

Table 5-1. Some commonly used registered link relation types

Name

Purpose ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required