| Summary: | Add GET endpoint for counting checkouts | ||
|---|---|---|---|
| Product: | Koha | Reporter: | Alex Arnaud <alex.arnaud> |
| Component: | REST API | Assignee: | Bugs List <koha-bugs> |
| Status: | CLOSED WORKSFORME | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P5 - low | CC: | jonathan.druart, lucas, tomascohen |
| Version: | unspecified | ||
| Hardware: | All | ||
| OS: | All | ||
| GIT URL: | Initiative type: | --- | |
| Sponsorship status: | --- | Comma delimited list of Sponsors: | |
| Crowdfunding goal: | 0 | Patch complexity: | --- |
| Documentation contact: | Documentation submission: | ||
| Text to go in the release notes: | Version(s) released in: | ||
| Circulation function: | |||
| Attachments: | Bug 36562: [REST API] Add GET endpoint for counting checkouts | ||
|
Description
Alex Arnaud
2024-04-10 07:05:34 UTC
Created attachment 164578 [details] [review] Bug 36562: [REST API] Add GET endpoint for counting checkouts Test plan: curl -v -s -u koha:koha --request GET http://kohadev.local/api/v1/checkouts/count?patron_id=1 Available parameters and permissions are the same than for listing checkouts The way to do this, is to perform a: curl -v -s -u koha:koha --request GET http://kohadev.local/api/v1/checkouts?q={"patron_id":1}&_per_page=1&_page_1 and read the X-Total-Count header from the response. I was about to point you to the http-client.js library, but it seems the .count method hasn't been ported from the Vue counterpart. Look at the Vue one for more information. Adding Jonathan, maybe he can comment on why that's not there. Another option would be to add
- +strings
+ - checkouts+count
- extended_attributes
to the 'x-koha-embed' definition for GET /patrons/:patron_id. This is already done in GET /patrons so should work out of the box with that simple spec change.
The correct way here is to have GET /patrons/{patron_id}/checkouts and read the X-Total-Count and X-Base-Total-Count headers.
|