Suppose that we have a Post resource (this is just a dummy example):
GET /api/posts/1
{
"id": 1,
"header": null,
"content": null
}
And now we'd like to create a Header inside the Post#1.
POST /api/posts/1/header
{
"color": "blue",
"title": "Some title"
}
Now, is it okay for the POST request above to return the following response?
{
"id": 1,
"header": {
"id": 1,
"color": "blue",
"title": "Some title"
},
"content": null
}
So, basically, a Header was created inside the Post and returned as part of the Post.
Also, if we need to GET the header for Post#1:
GET api/posts/1/header
{
"id": 1,
"color": "blue",
"title": "Some title"
}
So here only the Header is returned.