Search code examples
apiresthateoashypermediahal-json

HAL+JSON representation for links with the same rel


The HAL specification says:

Note: If you're unsure whether the link should be singular, assume it will be multiple. If you pick singular and find you need to change it, you will need to create a new link relation or face breaking existing clients.

Does making a link with a particular rel singular or multiple only apply to the use of that rel within a particular resource-representation, or does it apply to the use of that rel in any resource-representation?

For example, if I have decided that links under the item rel should always be multiple inside some resource X, does that constraint only hold for resource X, or will it also hold for resource Y if I happen to use item there as well?


Solution

  • Link relation types are defined independently to resource representations. In fact regularly they are defined independently to media type so that they can be used across media types.

    Also be aware the link relation 'item' has already been defined and standardized See http://www.iana.org/assignments/link-relations/link-relations.xhtml