There is an old thread talking about updating shelves in one call, but it did not seem to go very far.
Currently, to synchronize shelves between my app and goodreads I have to do the following:
- book.show (to get shelves in goodreads) - shelves.add_to_shelf with a=remove for any shelf that is listed in goodreads but not in my collection - shelves.add_to_shelf (without 'a') for any shelf that is in my local app but not in goodreads.
For a book on 3 shelves, this is up to 4 API calls. Just to remove a book from one shelf it is 2 API calls, one of them quite expesive-looking (book.show).
Solution
Add 'book.shelves' with a POST and a GET version, accepting a book ID and a array/list of shelf names.
POST will replace all goodreads shelves for the book with the ones passed.
GET will return an array of all goodreads shelves.
Why do this?
Fewer, and probably cheaper, API calls: for me to send an update is 1 call. For me to retrieve an update I will still just use review.list as currently.
Why have GET method
Completness & symmetry. Someone will probably ask for it. But it is by no means essential.
There is an old thread talking about updating shelves in one call, but it did not seem to go very far.
Currently, to synchronize shelves between my app and goodreads I have to do the following:
- book.show (to get shelves in goodreads)
- shelves.add_to_shelf with a=remove for any shelf that is listed in goodreads but not in my collection
- shelves.add_to_shelf (without 'a') for any shelf that is in my local app but not in goodreads.
For a book on 3 shelves, this is up to 4 API calls. Just to remove a book from one shelf it is 2 API calls, one of them quite expesive-looking (book.show).
Solution
Add 'book.shelves' with a POST and a GET version, accepting a book ID and a array/list of shelf names.
POST will replace all goodreads shelves for the book with the ones passed.
GET will return an array of all goodreads shelves.
Why do this?
Fewer, and probably cheaper, API calls: for me to send an update is 1 call. For me to retrieve an update I will still just use review.list as currently.
Why have GET method
Completness & symmetry. Someone will probably ask for it. But it is by no means essential.