0
  1. In REST, do we always use link relation values to convey semantics/role of a linked resource?

  2. I assume link relation value is always specified using rel attribute?

  3. Should rel attribute only be specified within a hypermedia control?

  4. I assume for an element to be considered a hypermedia control it must provide a linking functionality and must also contain a rel attribute?

1

In REST, do we always use link relation values to convey semantics/role of a linked resource?

Using link relations is just one way to add semantics to links. The other standard solution to use RDF vocabs, for example hydra or schema.org.

I assume link relation value is always specified using rel attribute?

This depends on the media type, for example by HAL+JSON you do something like this:

{
    "nick": "John",
    "_links": {
        "self": {
            "href": "http://example.com/users/john"
        }
    }
}

Should rel attribute only be specified within a hypermedia control? I assume for an element to be considered a hypermedia control it must provide a linking functionality and must also contain a rel attribute?

That again depends on the media type. For example by HTML only LINK elements can have relations, so you can add semantics only to GET requests. Other elements which use hyperlinks as well - for example FORM, IMG, etc. - cannot have relations as far as I know. By them you can use RDFa to add link relation. Btw. HTML is not the best hypermedia type for REST, since it is about machine to machine communication and HTML is for building GUIs for humans...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.