Bug 37253 - Enhance POST /checkouts endpoint to accept barcode or item_id
Summary: Enhance POST /checkouts endpoint to accept barcode or item_id
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: REST API (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-07-04 08:43 UTC by Jan Kissig
Modified: 2024-07-04 12:13 UTC (History)
1 user (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 37253: Enhance POST /checkouts endpoint to accept barcode or item_id (4.06 KB, patch)
2024-07-04 12:13 UTC, Jan Kissig
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Kissig 2024-07-04 08:43:27 UTC
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.
Comment 1 Jan Kissig 2024-07-04 12:13:00 UTC
Created attachment 168503 [details] [review]
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