| Summary: | Add /holds/cancellation_bulk endpoint | ||
|---|---|---|---|
| Product: | Koha | Reporter: | Pedro Amorim <pedro.amorim> |
| Component: | REST API | Assignee: | Pedro Amorim <pedro.amorim> |
| Status: | Passed QA --- | QA Contact: | Andrew Fuerste-Henry <andrew> |
| Severity: | enhancement | ||
| Priority: | P5 - low | CC: | andrew, lucas, martin.renvoize, pedro.amorim, tomascohen |
| Version: | Main | ||
| Hardware: | All | ||
| OS: | All | ||
| 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: | ||
| Bug Depends on: | 40552 | ||
| Bug Blocks: | 40551 | ||
| Attachments: |
Bug 40550: Add API tests
Bug 40550: Add cancellation_bulk API endpoint Bug 40550: Add API tests Bug 40550: Add cancellation_bulk API endpoint Bug 40550: Add API tests Bug 40550: Add cancellation_bulk API endpoint |
||
|
Description
Pedro Amorim
2025-07-30 11:34:29 UTC
Created attachment 184863 [details] [review] Bug 40550: Add API tests prove t/db_dependent/api/v1/holds.t Created attachment 184864 [details] [review] Bug 40550: Add cancellation_bulk API endpoint 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> Created attachment 185523 [details] [review] Bug 40550: Add cancellation_bulk API endpoint Signed-off-by: Phillip Berg <phillip.berg@mainlib.org> 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> 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> |