Linking to objects
REST resources that reference other resources, such as an account referencing its parent directory, represent the reference as a link
. A link
is an object nested within an existing resource representation that has an href
attribute. The href
attribute is the fully qualified location URI of the linked resource.
A link
object:
{
"href": "<baseURL>/v2/someCollection/{ref}"
}
This JSON object structure is called a link
because it provides a similar functionality to more familiar HTML anchors that are often called hyperlinks or links for short. You can use the href
attribute within the link
object to interact with that resource, if required.
This someCollection
resource has more than one link: the resource itself and the items
in the resource collection:
{
"href": "<baseURL>/v2/someCollection",
"offset": 0,
"limit": 10,
"items" : [
{
"href": "<baseURL>/v2/someCollection/37e60a14-9198-4b38-8bc3-f3924e2b6fe4"
},
{
"href": "<baseURL>/v2/someCollection/D1548691-47DF-41B6-A7B7-77516A76D62C"
}
]
}