[Bug 31797] New: REST API: DELETE endpoint for Items
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31797 Bug ID: 31797 Summary: REST API: DELETE 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=31797 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=31797 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=31797 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff Patch complexity|--- |Small patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31797 --- Comment #1 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 144843 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=144843&action=edit Bug 31797: Add DELETE /items/:item_id endpoint This patch adds the mentioned endpoint. The controller relies on Koha::Item->safe_to_delete for checks and uses `safe_delete` as additem.pl does. The required permissions are edit_catalogue. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/api/v1/items.t => SUCCESS: Tests pass! 3. Play with item deletion using a REST tool like Postman => SUCCESS: All works as expected 4. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31797 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lucas@bywatersolutions.com --- Comment #2 from Lucas Gass <lucas@bywatersolutions.com> --- Playing around with ajax(), this seems to work well: $.ajax({ url: '/api/v1/items/307', method: 'DELETE', contentType: 'application/json', success: function(result) { console.log('deleted') }, }); -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31797 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=31797 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #144843|0 |1 is obsolete| | --- Comment #3 from Lucas Gass <lucas@bywatersolutions.com> --- Created attachment 144892 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=144892&action=edit Bug 31797: Add DELETE /items/:item_id endpoint This patch adds the mentioned endpoint. The controller relies on Koha::Item->safe_to_delete for checks and uses `safe_delete` as additem.pl does. The required permissions are edit_catalogue. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/api/v1/items.t => SUCCESS: Tests pass! 3. Play with item deletion using a REST tool like Postman => SUCCESS: All works as expected 4. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> 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=31797 Agustín Moyano <agustinmoyano@theke.io> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |31798 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=31797 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |martin.renvoize@ptfs-europe | |.com --- Comment #4 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Code generally looks solid.. but I have 2 minor queries. 1. I believe we decided it was OK sticking to english for error descriptions in the API and that code could easily be used by end users for translations.. though I can't find reference to that conversation right now. 2. I find it a little annoying that we only send the first error instead of an array of all errors that apply. Perhaps we should think about that here? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31797 --- Comment #5 from Tomás Cohen Arazi <tomascohen@gmail.com> --- (In reply to Martin Renvoize from comment #4)
Code generally looks solid.. but I have 2 minor queries.
1. I believe we decided it was OK sticking to english for error descriptions in the API and that code could easily be used by end users for translations.. though I can't find reference to that conversation right now.
When we started the API, we only had a textual description of the error, in the 'error' key. Then bug 28020 introduced error codes. It included the introduction of a markup notation to describe such possible error codes for rendering in api.koha-community.org
2. I find it a little annoying that we only send the first error instead of an array of all errors that apply. Perhaps we should think about that here?
Yeah. Unfortunately: - The API would require a refactoring to allow that (i.e. all endpoints return one error...) - It would imply refactoring Koha::Item->safe_to_delete as well, which I'm not against (provided we have a switch to avoid performance penalties in things like batch deletes), but that's a major change for a more complete error response. I don't feel it is worth right now. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31797 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #144892|0 |1 is obsolete| | --- Comment #6 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 145743 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=145743&action=edit Bug 31797: Add DELETE /items/:item_id endpoint This patch adds the mentioned endpoint. The controller relies on Koha::Item->safe_to_delete for checks and uses `safe_delete` as additem.pl does. The required permissions are edit_catalogue. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/api/v1/items.t => SUCCESS: Tests pass! 3. Play with item deletion using a REST tool like Postman => SUCCESS: All works as expected 4. Sign off :-D Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31797 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA --- Comment #7 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Whilst I'd love to see an 'errors' array at some point, we discussed it and decided that was a feature for a v2 api if we want to do it cleanly. As such, Passing QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31797 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact| |martin.renvoize@ptfs-europe | |.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31797 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |23.05.00 released in| | Status|Passed QA |Pushed to master -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31797 --- Comment #8 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=31797 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Text to go in the| |This adds a DELETE endpoint release notes| |to allow for deleting 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=31797 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Text to go in the|This adds a DELETE endpoint | release notes|to allow for deleting items | |to the REST API. | Summary|REST API: DELETE endpoint |Add DELETE endpoint for |for Items |Items -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org