In the JSONAPI specification, under Resource Objects it gives this example of a resource:
{
"type": "articles",
"id": "1",
"attributes": {
"title": "Rails is Omakase"
},
"relationships": {
"author": {
"links": {
"self": "/articles/1/relationships/author",
"related": "/articles/1/author"
},
"data": { "type": "people", "id": "9" }
}
}
}
If I'm NOT using resource inclusion, what should my client be doing with the information contained in:
"data": { "type": "people", "id", "9" }
The response includes a link to the article
's author (/articles/1/author
) - and I can tell from reading the data { ... }
element of the response that the author of this article is the person with id=9
, but I can't actually do anything useful with that information.
It would seem intuitive that I could use this information to make a GET request to /people/9
to retrieve author details, but that doesn't appear to be part of the JSONAPI spec (although there is a recommendation along these lines regarding URLs for resource collections)
Is the inline type/id
information only relevant in the context of either resource inclusion or cross-referencing with some previously cached response data? Or is there an undocumented convention about translating type+id
into a resource URL (GET /{type}/{id}
) ?