[Bug 37253] New: Enhance POST /checkouts endpoint to accept barcode or item_id
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37253 Bug ID: 37253 Summary: Enhance POST /checkouts endpoint to accept barcode or item_id Change sponsored?: --- Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: REST API Assignee: koha-bugs@lists.koha-community.org Reporter: bibliothek@th-wildau.de QA Contact: testopia@bugs.koha-community.org CC: tomascohen@gmail.com By now a new checkout is built at least by params patron_id and item_id. This makes it a bit difficult if you only have a barcode of the item available, f.e. from RFID middleware applications, as you have to make another API call to retrieve the item_id for a barcode first. I would propose to enhance the POST /checkouts (addCheckout) route to accept either item_id or barcode (external_id in API) as JSON params. -- 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=37253 Jan Kissig <bibliothek@th-wildau.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Trivial patch Status|NEW |Needs Signoff -- 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=37253 --- Comment #1 from Jan Kissig <bibliothek@th-wildau.de> --- Created attachment 168503 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=168503&action=edit Bug 37253: Enhance POST /checkouts endpoint to accept barcode or item_id This patch adds external_id as a body param in POST /checkouts which acts as the items barcode. This enhances the checkouts route to checkout items directly via barcode which could be useful for external tools like Koha Offline Circulation Tool Test plan: a) apply patch b) enable system preference RESTBasicAuth c) check out an item via an API testing tool. Be sure that item is not checked out already. Auth: username: koha & password: koha Body JSON: { "external_id" : "39999000011418", "library_id": "CPL" } POST http://localhost:8081/api/v1/checkouts d) check response code 201 and response content -- 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=37253 Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- 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=37253 Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #168503|0 |1 is obsolete| | --- Comment #2 from Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> --- Created attachment 168507 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=168507&action=edit Bug 37253: Enhance POST /checkouts endpoint to accept barcode or item_id This patch adds external_id as a body param in POST /checkouts which acts as the items barcode. This enhances the checkouts route to checkout items directly via barcode which could be useful for external tools like Koha Offline Circulation Tool Test plan: a) apply patch b) enable system preference RESTBasicAuth c) check out an item via an API testing tool. Be sure that item is not checked out already. Auth: username: koha & password: koha Body JSON: { "external_id" : "39999000011418", "library_id": "CPL", "patron_id": 5 } POST http://localhost:8081/api/v1/checkouts d) check response code 201 and response content Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> -- 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=37253 --- Comment #3 from Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> --- Created attachment 168508 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=168508&action=edit Bug 37253: Tidy changes Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> -- 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=37253 Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |matt.blenkinsop@ptfs-europe | |.com --- Comment #4 from Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> --- All works fine, just amended the test plan to include a patron_id and tidied a few lines to satisfy the QA tests -- 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=37253 --- Comment #5 from Jan Kissig <bibliothek@th-wildau.de> --- (In reply to Matt Blenkinsop from comment #4)
All works fine, just amended the test plan to include a patron_id
how could I miss that :/
and tidied a few lines to satisfy the QA tests
thx -- 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=37253 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |kyle@bywatersolutions.com |y.org | CC| |kyle@bywatersolutions.com -- 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=37253 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Failed QA --- Comment #6 from Kyle M Hall (khall) <kyle@bywatersolutions.com> --- * Proving /kohadevbox/koha/t/db_dependent/api/v1/checkouts.t KO! # Failed test '201 Created' # at /kohadevbox/koha/t/db_dependent/api/v1/checkouts.t line 495. # got: '400' # expected: '201' # Looks like you failed 1 test of 12. # Failed test 'add checkout' # at /kohadevbox/koha/t/db_dependent/api/v1/checkouts.t line 555. # Looks like you failed 1 test of 108. /kohadevbox/koha/t/db_dependent/api/v1/checkouts.t .. Dubious, test returned 1 (wstat 256, 0x100) Failed 1/108 subtests Test Summary Report ------------------- /kohadevbox/koha/t/db_dependent/api/v1/checkouts.t (Wstat: 256 (exited 1) Tests: 108 Failed: 1) Failed test: 108 Non-zero exit status: 1 Files=1, Tests=108, 4 wallclock secs ( 0.01 usr 0.00 sys + 3.38 cusr 0.21 csys = 3.60 CPU) Result: FAIL -- 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=37253 --- Comment #7 from Jan Kissig <bibliothek@th-wildau.de> --- (In reply to Kyle M Hall (khall) from comment #6)
* Proving /kohadevbox/koha/t/db_dependent/api/v1/checkouts.t KO!
# Failed test '201 Created' # at /kohadevbox/koha/t/db_dependent/api/v1/checkouts.t line 495. # got: '400' # expected: '201' # Looks like you failed 1 test of 12.
# Failed test 'add checkout' # at /kohadevbox/koha/t/db_dependent/api/v1/checkouts.t line 555. # Looks like you failed 1 test of 108. /kohadevbox/koha/t/db_dependent/api/v1/checkouts.t .. Dubious, test returned 1 (wstat 256, 0x100) Failed 1/108 subtests
Test Summary Report ------------------- /kohadevbox/koha/t/db_dependent/api/v1/checkouts.t (Wstat: 256 (exited 1) Tests: 108 Failed: 1) Failed test: 108 Non-zero exit status: 1 Files=1, Tests=108, 4 wallclock secs ( 0.01 usr 0.00 sys + 3.38 cusr 0.21 csys = 3.60 CPU) Result: FAIL
hey Kyle, did you run yarn build after applying the patch? -- 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=37253 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |bibliothek@th-wildau.de |ity.org | -- 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=37253 --- Comment #8 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Hi, I'd like to point out we should accept one of them but not both. If we accepted both, then we should check they belong to the same item! The two consecutive if+find look weird in the sense of the paragraph above. I had to deal with a similar situation in Koha/REST/V1/Auth/Password.pm:55 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37253 Jan Kissig <bibliothek@th-wildau.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #168508|0 |1 is obsolete| | --- Comment #9 from Jan Kissig <bibliothek@th-wildau.de> --- Created attachment 173014 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=173014&action=edit Bug 37253: Tidy changes Signed-off-by: Matt Blenkinsop <matt.blenkinsop@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=37253 Jan Kissig <bibliothek@th-wildau.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37253 Jan Kissig <bibliothek@th-wildau.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #168507|0 |1 is obsolete| | Attachment #173014|0 |1 is obsolete| | --- Comment #10 from Jan Kissig <bibliothek@th-wildau.de> --- Created attachment 173015 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=173015&action=edit Bug 37253: Enhance POST /checkouts endpoint to accept barcode or item_id This patch adds external_id as a body param in POST /checkouts which acts as the items barcode. This enhances the checkouts route to checkout items directly via barcode which could be useful for external tools like Koha Offline Circulation Tool Test plan: a) apply patch b) enable system preference RESTBasicAuth c) check out an item via an API testing tool. Be sure that item is not checked out already. Auth: username: koha & password: koha Body JSON: { "external_id" : "39999000011418", "library_id": "CPL", "patron_id": 5 } POST http://localhost:8081/api/v1/checkouts d) check response code 201 and response content Signed-off-by: Matt Blenkinsop <matt.blenkinsop@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=37253 --- Comment #11 from Jan Kissig <bibliothek@th-wildau.de> --- Created attachment 173016 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=173016&action=edit Bug 37253: Tidy changes Signed-off-by: Matt Blenkinsop <matt.blenkinsop@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=37253 --- Comment #12 from Jan Kissig <bibliothek@th-wildau.de> --- please ignore last 2 patches a I am struggling with git -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37253 Jan Kissig <bibliothek@th-wildau.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #173015|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37253 Jan Kissig <bibliothek@th-wildau.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #173016|0 |1 is obsolete| | --- Comment #13 from Jan Kissig <bibliothek@th-wildau.de> --- Created attachment 173047 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=173047&action=edit Bug 37253: Enhance POST /checkouts endpoint to accept barcode or item_id This patch adds external_id as a body param in POST /checkouts which acts as the items barcode. This enhances the checkouts route to checkout items directly via barcode which could be useful for external tools like Koha Offline Circulation Tool. When item_id and external_id are given a check is performed that both identifiers belong to the same item. Test plan: a) apply patch b) enable system preference RESTBasicAuth c) check out an item via an API testing tool. Be sure that item is not checked out already. Auth: username: koha & password: koha Body JSON: { "external_id" : "39999000011418", "library_id": "CPL", "patron_id": 5 } POST http://localhost:8081/api/v1/checkouts d) check response code 201 and response content Signed-off-by: Matt Blenkinsop <matt.blenkinsop@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=37253 Kyle M Hall (khall) <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Patch doesn't apply -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37253 --- Comment #14 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Jan, please rebase against latest main: ```shell git rebase -i origin/main ``` and resubmit. If it depends on some other bug please mark it so. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37253 Jan Kissig <bibliothek@th-wildau.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #168508|1 |0 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37253 Jan Kissig <bibliothek@th-wildau.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #168507|1 |0 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37253 Jan Kissig <bibliothek@th-wildau.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Patch doesn't apply |Needs Signoff --- Comment #15 from Jan Kissig <bibliothek@th-wildau.de> --- (In reply to Tomás Cohen Arazi (tcohen) from comment #14)
Jan, please rebase against latest main:
```shell git rebase -i origin/main ```
and resubmit. If it depends on some other bug please mark it so.
I obsoleted the former patches by accident and 'de'obsoleted them. Patch applies now to main -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37253 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.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=37253 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #168507|0 |1 is obsolete| | Attachment #168508|0 |1 is obsolete| | Attachment #173047|0 |1 is obsolete| | --- Comment #16 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 173139 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=173139&action=edit Bug 37253: Enhance POST /checkouts endpoint to accept barcode or item_id This patch adds external_id as a body param in POST /checkouts which acts as the items barcode. This enhances the checkouts route to checkout items directly via barcode which could be useful for external tools like Koha Offline Circulation Tool Test plan: a) apply patch b) enable system preference RESTBasicAuth c) check out an item via an API testing tool. Be sure that item is not checked out already. Auth: username: koha & password: koha Body JSON: { "external_id" : "39999000011418", "library_id": "CPL", "patron_id": 5 } POST http://localhost:8081/api/v1/checkouts d) check response code 201 and response content Signed-off-by: Matt Blenkinsop <matt.blenkinsop@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=37253 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.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=37253 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #173139|0 |1 is obsolete| | --- Comment #17 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 173140 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=173140&action=edit Bug 37253: Enhance POST /checkouts endpoint to accept barcode or item_id This patch adds external_id as a body param in POST /checkouts which acts as the items barcode. This enhances the checkouts route to checkout items directly via barcode which could be useful for external tools like Koha Offline Circulation Tool Test plan: a) apply patch b) enable system preference RESTBasicAuth c) check out an item via an API testing tool. Be sure that item is not checked out already. Auth: username: koha & password: koha Body JSON: { "external_id" : "39999000011418", "library_id": "CPL", "patron_id": 5 } POST http://localhost:8081/api/v1/checkouts d) check response code 201 and response content Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> 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=37253 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|kyle@bywatersolutions.com |tomascohen@gmail.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37253 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |release-notes-needed -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37253 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |24.11.00 released in| | Status|Passed QA |Pushed to main -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37253 --- Comment #18 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Pushed for 24.11! Well done everyone, thank you! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37253 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lucas@bywatersolutions.com Status|Pushed to main |Pushed to stable --- Comment #19 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Enhancement, no 24.05.x backport -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37253 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Text to go in the| |The enhancement adds the release notes| |ability to accept the | |barcode for a checkout via | |the API. If the origin only | |had access to the barcode | |and not the itemnumber a | |second API call was | |previously required to | |perform a checkout with | |only the barcode. CC| |lisette@bywatersolutions.co | |m Keywords|release-notes-needed | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37253 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to stable |Needs documenting -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37253 Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|Needs documenting |RESOLVED CC| |caroline.cyr-la-rose@inlibr | |o.com --- Comment #20 from Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> --- Nothing to add/edit in the manual. If API documentation is needed, please reopen with details. -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org