[Bug 31799] New: REST API: PUT endpoint for Items
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31799 Bug ID: 31799 Summary: REST API: PUT endpoint for Items Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: new feature Priority: P5 - low Component: REST API Assignee: koha-bugs@lists.koha-community.org Reporter: nick@bywatersolutions.com CC: tomascohen@gmail.com -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31799 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |31789 Change sponsored?|--- |Sponsored Assignee|koha-bugs@lists.koha-commun |tomascohen@gmail.com |ity.org | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31789 [Bug 31789] REST API: CRUD endpoint for Items -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31799 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|tomascohen@gmail.com |agustinmoyano@theke.io -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31799 Agustín Moyano <agustinmoyano@theke.io> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |31798 Patch complexity|--- |Trivial patch Status|NEW |Needs Signoff Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31798 [Bug 31798] REST API: POST endpoint for Items -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31799 --- Comment #1 from Agustín Moyano <agustinmoyano@theke.io> --- Created attachment 144902 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=144902&action=edit Bug 31799: Add REST endpoint to modify a biblio's item To test: 1. Apply patch 2. Set RESTBasicAuth preference to true 3. Get a biblio with an item 4. Make a PUT request to /api/v1/biblios/:biblio_id/items/:item_id with a json body that represents an item to replace 5. Check that the item was modified 6. Sign off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31799 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|Trivial patch |Small patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31799 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lucas@bywatersolutions.com --- Comment #2 from Lucas Gass <lucas@bywatersolutions.com> --- Tested with different iterations of this: $.ajax({ url: '/api/v1/biblios/55/items/117', method: 'PUT', data: JSON.stringify({ "collection_code": "COLLECTION1", "external_id": "123test", }), contentType: 'application/json', success: function(result) { console.log('altered') }, }); -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31799 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31799 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #144902|0 |1 is obsolete| | --- Comment #3 from Lucas Gass <lucas@bywatersolutions.com> --- Created attachment 144949 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=144949&action=edit Bug 31799: Add REST endpoint to modify a biblio's item To test: 1. Apply patch 2. Set RESTBasicAuth preference to true 3. Get a biblio with an item 4. Make a PUT request to /api/v1/biblios/:biblio_id/items/:item_id with a json body that represents an item to replace 5. Check that the item was modified 6. Sign off Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31799 --- Comment #4 from Agustín Moyano <agustinmoyano@theke.io> --- Created attachment 144959 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=144959&action=edit Bug 31799: (follow-up) Tidy up and fix duplicate barcode handling -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31799 --- Comment #5 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 145632 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=145632&action=edit Bug 31799: (follow-up) Add 409 error to spec -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31799 Jonathan Druart <jonathan.druart+koha@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart+koha@gmail. | |com --- Comment #6 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- I don't think you are supposed to check the uniqueness of the barcode, it's at the DBMS level already. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31799 --- Comment #7 from Jonathan Druart <jonathan.druart+koha@gmail.com> --- PUT is expecting a full resource, if you want to partially modify a resource you need PATCH. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31799 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |martin.renvoize@ptfs-europe | |.com --- Comment #8 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- I'd also argue that this is perhaps misplaced endpoint wise.. we already have a few `/items` endpoints.. whilst I understand the logic being `POST /biblios/{biblio_id}/items` I'm not so sure that logic holds here.. Shouldn't this be `PUT /items/{item_id}` or indeed if we want partial update `PATCH /items/{item_id}`. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31799 --- Comment #9 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- (In reply to Jonathan Druart from comment #6)
I don't think you are supposed to check the uniqueness of the barcode, it's at the DBMS level already.
He already fixed this in a followup above ;P -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31799 --- Comment #10 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Also.. should we allow moving an item between biblios on this endpoint.. or should biblio_id really be a readOnly here? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31799 --- Comment #11 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to Martin Renvoize from comment #8)
I'd also argue that this is perhaps misplaced endpoint wise.. we already have a few `/items` endpoints.. whilst I understand the logic being `POST /biblios/{biblio_id}/items` I'm not so sure that logic holds here.. Shouldn't this be `PUT /items/{item_id}` or indeed if we want partial update `PATCH /items/{item_id}`.
This is opinion/taste. Should we vote it? I guess it wouldn't hurt to have both endpoints. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31799 --- Comment #12 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to Jonathan Druart from comment #7)
PUT is expecting a full resource, if you want to partially modify a resource you need PATCH.
Most of our PUT are actually PATCH. I wouldn't mind asking Agustin to just change the verb to the more correct form. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31799 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |m.de.rooy@rijksmuseum.nl Status|Signed Off |BLOCKED --- Comment #13 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- QAing -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31799 Agustín Moyano <agustinmoyano@theke.io> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|BLOCKED |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31799 Agustín Moyano <agustinmoyano@theke.io> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #144949|0 |1 is obsolete| | Attachment #144959|0 |1 is obsolete| | Attachment #145632|0 |1 is obsolete| | --- Comment #14 from Agustín Moyano <agustinmoyano@theke.io> --- Created attachment 150607 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=150607&action=edit Bug 31799: Add REST endpoint to modify a biblio's item To test: 1. Apply patch 2. Set RESTBasicAuth preference to true 3. Get a biblio with an item 4. Make a PUT request to /api/v1/biblios/:biblio_id/items/:item_id with a json body that represents an item to replace 5. Check that the item was modified 6. Sign off Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31799 --- Comment #15 from Agustín Moyano <agustinmoyano@theke.io> --- Created attachment 150608 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=150608&action=edit Bug 31799: (follow-up) Tidy up and fix duplicate barcode handling -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31799 --- Comment #16 from Agustín Moyano <agustinmoyano@theke.io> --- Created attachment 150609 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=150609&action=edit Bug 31799: (follow-up) Add 409 error to spec -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31799 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31799 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #150607|0 |1 is obsolete| | Attachment #150608|0 |1 is obsolete| | Attachment #150609|0 |1 is obsolete| | --- Comment #17 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 150741 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=150741&action=edit Bug 31799: Add REST endpoint to modify a biblio's item To test: 1. Apply patch 2. Set RESTBasicAuth preference to true 3. Get a biblio with an item 4. Make a PUT request to /api/v1/biblios/:biblio_id/items/:item_id with a json body that represents an item to replace 5. Check that the item was modified 6. Sign off Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31799 --- Comment #18 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 150742 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=150742&action=edit Bug 31799: (follow-up) Tidy up and fix duplicate barcode handling Signed-off-by: Nick Clemens <nick@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31799 --- Comment #19 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 150743 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=150743&action=edit Bug 31799: (follow-up) Add 409 error to spec Signed-off-by: Nick Clemens <nick@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31799 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to master Version(s)| |23.05.00 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31799 --- Comment #20 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Pushed to master for 23.05. Nice work everyone, thanks! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31799 Bug 31799 depends on bug 31798, which changed state. Bug 31798 Summary: REST API: POST endpoint for Items https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31798 What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to master |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31799 Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |matt.blenkinsop@ptfs-europe | |.com Resolution|--- |FIXED Status|Pushed to master |RESOLVED --- Comment #21 from Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> --- Enhancement - not backporting to 22.11.x -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31799 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Text to go in the| |This adds a PUT endpoint release notes| |for updating items to the | |REST API. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31799 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Text to go in the|This adds a PUT endpoint | release notes|for updating items to the | |REST API. | Summary|REST API: PUT endpoint for |Add PUT endpoint for Items |Items | -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org