Bug 40550 - Add /holds/cancellation_bulk endpoint
Summary: Add /holds/cancellation_bulk endpoint
Status: Passed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: REST API (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Pedro Amorim
QA Contact: Andrew Fuerste-Henry
URL:
Keywords:
Depends on: 40552
Blocks: 40551
  Show dependency treegraph
 
Reported: 2025-07-30 11:34 UTC by Pedro Amorim
Modified: 2025-09-29 15:26 UTC (History)
5 users (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: ---
Crowdfunding goal: 0
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
A new REST API endpoint `/api/v1/holds/cancellation_bulk` has been added to support cancelling multiple holds in a single request, with the cancellations processed as a background job. This endpoint accepts an array of hold IDs and optionally a cancellation reason, then queues a background job to process the cancellations asynchronously. This prevents timeouts and improves performance when cancelling large numbers of holds. **Endpoint details:** - **Method:** POST - **Path:** `/api/v1/holds/cancellation_bulk` - **Parameters:** - `hold_ids` (required): Array of hold IDs to cancel - `cancellation_reason` (optional): Reason for cancellation - **Response:** Returns a background job ID for tracking the cancellation progress **For developers:** This endpoint is used by the staff interface patron holds tables (Bug 40551) to handle bulk hold cancellations. The background job approach ensures reliable processing even when dealing with hundreds of holds, and allows the user interface to remain responsive. **Required permissions:** - `reserveforothers` - Place and modify holds for patrons
Version(s) released in:
Circulation function:


Attachments
Bug 40550: Add API tests (4.57 KB, patch)
2025-07-30 11:36 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 40550: Add cancellation_bulk API endpoint (4.50 KB, patch)
2025-07-30 11:36 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 40550: Add API tests (4.62 KB, patch)
2025-08-18 20:05 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 40550: Add cancellation_bulk API endpoint (4.56 KB, patch)
2025-08-18 20:05 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 40550: Add API tests (4.69 KB, patch)
2025-09-26 20:24 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 40550: Add cancellation_bulk API endpoint (4.62 KB, patch)
2025-09-26 20:24 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Pedro Amorim 2025-07-30 11:34:29 UTC

    
Comment 1 Pedro Amorim 2025-07-30 11:36:40 UTC
Created attachment 184863 [details] [review]
Bug 40550: Add API tests

prove t/db_dependent/api/v1/holds.t
Comment 2 Pedro Amorim 2025-07-30 11:36:43 UTC
Created attachment 184864 [details] [review]
Bug 40550: Add cancellation_bulk API endpoint
Comment 3 Andrew Fuerste-Henry 2025-08-18 20:05:00 UTC
Created attachment 185522 [details] [review]
Bug 40550: Add API tests

prove t/db_dependent/api/v1/holds.t

Signed-off-by: Phillip Berg <phillip.berg@mainlib.org>
Comment 4 Andrew Fuerste-Henry 2025-08-18 20:05:02 UTC
Created attachment 185523 [details] [review]
Bug 40550: Add cancellation_bulk API endpoint

Signed-off-by: Phillip Berg <phillip.berg@mainlib.org>
Comment 5 Andrew Fuerste-Henry 2025-09-26 20:24:04 UTC
Created attachment 187017 [details] [review]
Bug 40550: Add API tests

prove t/db_dependent/api/v1/holds.t

Signed-off-by: Phillip Berg <phillip.berg@mainlib.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Comment 6 Andrew Fuerste-Henry 2025-09-26 20:24:07 UTC
Created attachment 187018 [details] [review]
Bug 40550: Add cancellation_bulk API endpoint

Signed-off-by: Phillip Berg <phillip.berg@mainlib.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>