Closed aholachek closed 9 years ago
This "should" only need the updating of two lines, but inclusion of a few sanity tests. At the same time I will update the POST for the DocumentView so that it accepts lists of bibcodes.
Might it make sense to just have a POST (instead of a POST and a PUT) for the document view, but with the following parameters : {bibcodes [{bibcode: 1, add: true}, {bibcode: 2, add: true}], metadata : {name :"foo", description: foo}}?
Semantically I think the PUT should be for updating something, hence updating the name and description of the library, which already exist.
If you're adding/removing content, I see this as creating/destroying, which is a POST request given the thing you're adding does not exist.
Alternatively you could argue that you're updating the list, so they should all be PUT requests after you create the library.
I would prefer the following to work:
POST
{bibcodes: ['2015MRNAS..20...E', '2025ApJ..20...E', '2013A&A..20...F'], action: 'add'}
Is there a drive to have 'add': true
or 'remove': true
. I would assume on the UI that you can select a bunch of bibcodes and press 'remove'. You wouldn't select a bunch and press 'remove' and then select another bunch and press 'add' and then press 'go'?
i.e., I see 'adding' as one step (when viewing articles) and hence the 'action': 'add'
and I see the 'removing' as one step (when inside your library), and hence the 'action': 'remove'
.
I personally feel this separates the logic and makes it more simple to understand.
Also, later it might make sense to place the transfer of ownership in the PUT request, keeping it RESTful (issue #47).
Ok I understand now. Thanks for explaining the reasoning behind POST vs PUT.
I was confused before about the post to /library/library-id; I thought you were using [{bibcode: add}, {bibcode:remove}] etc but I wasn't sure why, the bulk add/remove makes more sense.
On Thu, Jun 4, 2015 at 5:25 AM, Jonny Elliott notifications@github.com wrote:
Also, later it might make sense to place the transfer of ownership in the PUT request, keeping it RESTful (issue #47 https://github.com/adsabs/biblib-service/issues/47).
— Reply to this email directly or view it on GitHub https://github.com/adsabs/biblib-service/issues/36#issuecomment-108804037 .
It would be convenient to be able to submit bibcodes when you POST to /libraries/ to create a new library, cutting out a second request to /documents/ to add things to the library