I am having confusion while choosing a database relation and Restful URI for application I am developing.
I am making a simple library application with following requirements.
- Book can belong to many categories e.g Physics book belong to Textbook and Science Category. We can say book have many categories/labels/tags.
- Viewing books in one category.
- Viewing a book's all categories.
- Searching book using categories or book information.
- Book CRUD operations
- Label CRUD operations
Considering all these requirements I choose ManyToMany relation between Books and Labels. I have implemented it using Hibernate Framework. Now when it came to designing Restful Services for this its getting very confusing.It makes me question table relationship choice as well.
Restful uri made yet.
/books
/books/{bookid}
/labels
/labels/{labelid}
But when I want to get a list of labels against a book, or a list of books against a label. How to map them using Restful URI. I can think of this
/book/{bookid}/labels
But considering this,how to map getting a list of books against one label
I want to know whether my choice of table relationship is right and if yes, how to design restful uri against it. And if no, please correct me and put a light on this scenario. Thanks