Consider that I'm using the following RESTful API endpoints:
- /users/: show all users
- /users/$user_id/: show specific user
- /users/$user_id/posts/: show all posts by user
- /users/$user_id/posts/$post_id/: show specific post by user
Constraint in this data model: a post always has a user.
By "processing nested resources" I mean handling the CRUD operations.
Should I implement the CRUD operations (POST, PUT, PATCH, DELETE) on the /users/$user_id/posts/ endpoint or should I create another endpoint /posts/ and handle the CRUD operations there, while keeping the first endpoint read-only?
Sorry if this question already exists in maybe another form on SO. :-) There's so much "FUD" around RESTful APIs.
Thanks in advance for any tips/clarifications!
Kind regards, K.