Summary: | Item transfer operations should be available from the API | ||
---|---|---|---|
Product: | Koha | Reporter: | Martin Renvoize (ashimema) <martin.renvoize> |
Component: | REST API | Assignee: | Johanna Räisä <johanna.raisa> |
Status: | Signed Off --- | QA Contact: | |
Severity: | enhancement | ||
Priority: | P5 - low | CC: | angus.purcell, bernard.scaife, johanna.raisa, lucy.vaux-harvey, tomascohen |
Version: | unspecified | ||
Hardware: | All | ||
OS: | All | ||
GIT URL: | Change sponsored?: | Sponsored | |
Patch complexity: | --- | Documentation contact: | |
Documentation submission: | Text to go in the release notes: | ||
Version(s) released in: | Circulation function: | ||
Bug Depends on: | |||
Bug Blocks: | 22160 | ||
Attachments: | Bug 35722: Create item transfer REST api |
Description
Martin Renvoize (ashimema)
2024-01-08 11:50:23 UTC
Hi! I have time and interest to do this. Have you done something so far? 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 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 |