| List all comments of a blog: GET /blog_comments/:blogId Creating a new comment: POST /comments (blog_id, author_id, category_id all in the post body) Single comment: GET /comments/1234 You can pretty much follow all the same normalization rules you would for a SQL database. /blog_comments is a kind of query in a virtual N-to-N resource that maps blogs to comments, get it? Consider for example, "all posts that this particular author commented on". That would be insane to put into a hierarchy URL. For a flat one, you can just: GET /commented_by/:authorId Boom, done. Sometimes, you'll need more than one id, of course, but that does not imply "nesting". Consider "all posts where these two authors interact on comments": GET /discussions_involving/:authorId1/:authorId2 There is a cap in what you can do with a hierachy, and the web is not a filesystem with folders, it's a graph with unlimited possibilities. |
GET /discussions?author=:authorId1,:authorId2
If both authors had participated.
Or if only one or the other had participated:
GET /discussions?author=:authorId1&author=:authorId2