Currently we can paginate checkouts using REST API. It could be useful to have the count only to prepare showing a paginated result.
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.