Thanks for this thread, it definitely helps clear up some confusion I had - I had a quick question regarding the response from GET
request to the related link.
In the first example above, as @ethanresnick mentioned, if the user makes the request:
GET /bands/1/relationships/drummer
At any point in time, the response should always include the resource object that represents the current drummer (or null, if the band has no drummer).
When representing that drummer, in the data
attribute of the response document, is it fair to include a data.links.self
attribute, that points to the direct link to that musician (based off of /musicians
)?
A response like:
{
"links": {
"self": "http://examples.com/bands/1/relationships/drummer"
}
"data": {
"type": "musicians",
"id": "9",
"attributes": {
firstName: "Matt"
},
"links": {
"self": "http://example.com/musicians/9"
}
}
And if musicians also had another association, like, their “preferred” equipment, could those relationships be included as part of the document above, say under data.relationships
?
My main point being - http://examples.com/bands/1/relationships/drummer
is the end of the road (no more sub-nodes)… if the requestor wants to find more details related to this particular “current drummer”, they’ll start issuing requests based off of the http://example.com/musicians/9
resource. Is this correct thinking?
Thanks for your help!