I am developing a sedative api and am trying to do it right the first time.
I have identified some of the embedded resources (comments in a blog post), and this choice reflects the fact that the comments are embedded in the blog document in mongo.
I'm not interested in serving individual comments from the context, so I deferred the implementation of GET for nested resources. However, it makes sense to embed POSTing in the comment collection and PUTting in the uri comment.
Concrete questions:
1) Does it make sense to respond to POST with 201 and the location header set to the parent resource? If not, how do I tell the parent location to inform client navigation options?
2) A similar question for PUT, what is the best way to tell the client that it must look for the parent resource in order to find its update? (preferably if the client should not make assumptions about my uri scheme). Is the location header reasonable at 200?
Bnwasteland
source share