I have created the following entities, Book
, Chapter
and Feedback
. The Book
have many Chapter
entities, and it also have many Feedback
entities. Since no Chapter
entities could live by them self they are part of the Book
composition. The same applies to the Feedback
entitiy.
My question is whether objects that are part of an composition should have their own URIs in a RESTful system? Such as:
/books/1/chapters (With POST, DELETE, PUT operations)
/books/1/feedback (With POST, DELETE, PUT operations)
Or should it be threated like this:
/books/1 (With POST, DELETE, PUT operations only on the book)
The last URI mean that the users of the API would have to add a feedback to an array of the book and then update the whole book entity.
And does it make sense to call the relationship between books and chapters "composition + aggregation" since chapters doesn't belong to any other object and their life cycle is dependent of book?