Im pretty new to REST but as far as i have gathered i understand that the following URL's conform to the REST principles. Where the resources are laid out as follows:
/user/<username>/library/book/<id>/tags ^ ^ ^ ^ |---------|-----------|---|- user resource with username as a variable |-----------|---|- many to one collection (books) |---|- book id |- many to one collection (tags) GET /user/dave/library/book //retrieves a list of books id's GET /user/dave/library/book/1 //retrieves info on book id=1 GET /user/dave/library/book/1/tags //retrieves tags collection (book id=1)
However, how would one go about optimizing this example API? Say for example i have 10K books in my library and i want to fetch the details of every book in my library. should i really force a http call to
/library/book/<id> for every id given in
/library/book? Or should i enable multiple id's as parameters?
/library/book/<id1>,<id2>... and do like bulk fetching with a 100 id's at a time?
What does the REST principles say about this kind of situation? and what are your opinion(s)?