Links are hyperlinks to other resource endpoints. They point to resources which have some relation with the resource in which they are embedded and are specified according to the HAL specification.
For single resources a linked relation is either a URI to another single resource or the URI to a collection of resources.
Collection resources have one linked relation, namely, a list of URIs to every resource it contains.
In some cases where you POST or PUT to a resource you might need relational data similar to
that what is in the _links section during retrieval. The convention is that you are allowed to
add an additional object to the resource body with the property name being equal to what would be
its name in the _links section. This object should contain a type
and an EID
property.
Single resource
{
"_links": {
"self": {
"href": "/networks/0123456789abcdef/messages/0000000000000000/"
},
"author": {
"href": "/networks/0123456789abcdef/users/abcdef0123456789/"
},
"comments": {
"href": "/networks/0123456789abcdef/messages/?parent=0000000000000000"
},
"recipient": {
"href": "/networks/0123456789abcdef/"
}
},
"EID": "0000000000000000",
"body": "Welcome to Speakap!",
"numComments": 2,
"type": "message"
}
Collection
{
"_links": {
"self": {
"href": "/networks/0123456789abcdef/timeline/"
},
"messages": [
{
"href": "/networks/0123456789abcdef/messages/0000000000000002/"
},
{
"href": "/networks/0123456789abcdef/messages/0000000000000001/"
},
{
"href": "/networks/0123456789abcdef/messages/0000000000000000/"
}
]
}
}