Links are our formalization of HATEOAS, which is one of the core principles of REST APIs.
From our previous example, a links
block looks like this:
resource Account {
data Profile
links {
change-password -> ChangePassword,
change-email -> ChangeEmail,
}
PATCH @self% -> @self
}
This block defines two links, change-password
and change-email
, which the server implementation will render as URI strings that point to the Resource Classes ChangePassword
and ChangeEmail
respectively.
Currently, links are only serialized as URI strings, and the RC that they point to is inferred statically by the client. This will be extended to allow dynamic links, tracked by Custom / dynamic link serialization.
A links
block contains a comma-separated list consisting of a relation, the ->
, and then a Resource Class name.
Relation names can contain alphanumeric characters, underscores, and also dashes. Users are encouraged to use the standard link relations where it makes sense to do so, but you are free to come up with your own names as you see fit.