Bug 35722 - Item transfer operations should be available from the API
Summary: Item transfer operations should be available from the API
Status: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: REST API (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement
Assignee: Johanna Räisä
QA Contact:
URL:
Keywords:
Depends on:
Blocks: 22160
  Show dependency treegraph
 
Reported: 2024-01-08 11:50 UTC by Martin Renvoize (ashimema)
Modified: 2025-08-22 13:41 UTC (History)
5 users (show)

See Also:
GIT URL:
Change sponsored?: Sponsored
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 35722: Create item transfer REST api (29.16 KB, patch)
2025-06-06 11:58 UTC, Johanna Räisä
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Renvoize (ashimema) 2024-01-08 11:50:23 UTC
We don't expose the item transfer queue in the API yet.. we should.
Comment 1 Johanna Räisä 2025-06-02 08:13:43 UTC
Hi! I have time and interest to do this. Have you done something so far?
Comment 2 Johanna Räisä 2025-06-06 11:58:28 UTC
Created attachment 183069 [details] [review]
Bug 35722: Create item transfer REST api

This patch creates a REST API for item transfers, allowing users to
transfer items between libraries via the API.

Test Plan:
1. Apply the patch.
2. perl build-resources.PL
3. prove t/db_dependent/api/v1/items/item_transfers.t
4. Verify that the API endpoints for item transfers work as expected.

Sponsored-by: Koha-Suomi Oy
Comment 3 Bernard 2025-08-22 13:41:48 UTC
kohadev-koha@kohadevbox:koha(bug_35722)$ prove t/db_dependent/api/v1/items/item_transfers.t
t/db_dependent/api/v1/items/item_transfers.t .. ok
All tests successful.
Files=1, Tests=5, 10 wallclock secs ( 0.03 usr  0.01 sys +  7.95 cusr  0.70 csys =  8.69 CPU)
Result: PASS
kohadev-koha@kohadevbox:koha(bug_35722)$

Tested 

list
get
add
cancel


1. Ensured RESTBasicAuth enabled
2. Installed patch
3. Put an item in transfer in staff intranet. Circulation dashboard, click Transfer. Ensure item is in list of Transferred items.
4. Got itenumber from step 3 and did a curl request: curl --request GET "http://127.0.0.1:8080/api/v1/items/312/transfers" --header "Content-Type: application/json" --user u:p
5. Observed details: to_library_id and from_library_id match step above. Date requested and sent are set - PASS
6. Cancel request from the API

curl --request DELETE "http://127.0.0.1:8080/api/v1/items/312/transfers" --header "Content-Type: application/json" --user u:p

7. Listed as in step 4
8. Noted cancellation date added and request cancelled - PASS
9. Added new request

curl --request POST "http://127.0.0.1:8080/api/v1/items/313/transfers" --header "Content-Type: application/json" --user u:p --data-raw '{ "to_library_id": "FFL", "reason": "Manual" }'

10. Request added same as if via staff intranet - PASS
11. Tried to add a request for a staff user without permission reserveforothers: place_holds (Place holds for patrons) (edited user's permissions)
10. Repeated step 9 with another itemnumber.
11. Observed {"error":"Invalid password","required_permissions":null} - PASS
12. Listed all requests 

curl --request GET "http://127.0.0.1:8080/api/v1/items/transfers" --header "Content-Type: application/json" --user u:p

13. Observed list of requests returned - PASS