Checkouts API Question
Hi All - we are on 21.11, and would like to include patron account data in our bespoke University mobile app. I was planning on using the RESTful API to get the data. What we would like is simply a list of titles (plus author and ISBN) along with the due back dates. I'm struggling , when looking at https://api.koha-community.org/21.11.html, to see how this could be done without using lots of API calls. Would I have to do something like the following: * Call /checkouts to get a list of checkouts from the patron * Iterate over the checkout_id and call /checkouts/$id for each checkout * I cannot see any Biblio references in the returned data, so I'd have to then grab the biblio_id from the /items/$id endpoint and then call the /biblios endpoint to get the actual bibliographic data. If the patron had 10 items out this would be at least 30 calls to get the bib data. Is that what I would have to do, or am I missing something - like a header or extra query which would return all the info I require from the first endpoint call? Any advice/pointers would be much appreciated!! Cheers, Stephen -------------------------------------- Stephen Graham Library Technology Consultant Library and Computing Services University of Hertfordshire Hatfield, Hertfordshire, AL10 9AB Email: s.graham4@herts.ac.uk<mailto:s.graham4@herts.ac.uk> Website: herts.ac.uk
Hi Stephen, Although it's quite old, the ILS-DI interface is still available in 21.11. You can check the GetPatronInfo with "show_loans=1" parameter (perhaps by default?) to get the loans. Then you also get bibliographic information about those loans in one API call. However, ILS-DI is not secure by design, there is no authentication, which means, when you activate ILS-DI it is open to everyone to get personnal information on any of your patrons by scraping with random biblionumber, just be aware of this a put decent security (we use IP restriction which is not ideal but minimum required IMO) Best, Arthur Suzuki Developper @BibLibre On 12/07/2022 16:06, Stephen Graham wrote:
Hi All – we are on 21.11, and would like to include patron account data in our bespoke University mobile app. I was planning on using the RESTful API to get the data. What we would like is simply a list of titles (plus author and ISBN) along with the due back dates. I’m struggling , when looking at https://api.koha-community.org/21.11.html, to see how this could be done without using lots of API calls. Would I have to do something like the following:
* Call /checkouts to get a list of checkouts from the patron * Iterate over the checkout_id and call /checkouts/$id for each checkout * I cannot see any Biblio references in the returned data, so I’d have to then grab the biblio_id from the /items/$id endpoint and then call the /biblios endpoint to get the actual bibliographic data.
If the patron had 10 items out this would be at least 30 calls to get the bib data. Is that what I would have to do, or am I missing something – like a header or extra query which would return all the info I require from the first endpoint call?
Any advice/pointers would be much appreciated!!
Cheers, Stephen
--------------------------------------
Stephen Graham
Library Technology Consultant
Library and Computing Services
University of Hertfordshire
Hatfield, Hertfordshire, AL10 9AB
Email: s.graham4@herts.ac.uk <mailto:s.graham4@herts.ac.uk>
Website: herts.ac.uk
_______________________________________________ Koha-devel mailing list Koha-devel@lists.koha-community.org https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel website :https://www.koha-community.org/ git :https://git.koha-community.org/ bugs :https://bugs.koha-community.org/
Thanks Arthur for the quick reply! I had totally forgotten about the ILS-DI interface. We do have it set up on our test server – so that is defiantly an option. We have written a custom endpoint for something else previously so maybe we should explore that avenue again to achieve what we want – I prefer the Oauth2 authentication I think. Cheers, Stephen From: Koha-devel <koha-devel-bounces@lists.koha-community.org> On Behalf Of Arthur Sent: 12 July 2022 15:15 To: koha-devel@lists.koha-community.org Subject: Re: [Koha-devel] Checkouts API Question Hi Stephen, Although it's quite old, the ILS-DI interface is still available in 21.11. You can check the GetPatronInfo with "show_loans=1" parameter (perhaps by default?) to get the loans. Then you also get bibliographic information about those loans in one API call. However, ILS-DI is not secure by design, there is no authentication, which means, when you activate ILS-DI it is open to everyone to get personnal information on any of your patrons by scraping with random biblionumber, just be aware of this a put decent security (we use IP restriction which is not ideal but minimum required IMO) Best, Arthur Suzuki Developper @BibLibre On 12/07/2022 16:06, Stephen Graham wrote: Hi All – we are on 21.11, and would like to include patron account data in our bespoke University mobile app. I was planning on using the RESTful API to get the data. What we would like is simply a list of titles (plus author and ISBN) along with the due back dates. I’m struggling , when looking at https://api.koha-community.org/21.11.html<https://api.koha-community.org/21.11.html>, to see how this could be done without using lots of API calls. Would I have to do something like the following: 1. Call /checkouts to get a list of checkouts from the patron 2. Iterate over the checkout_id and call /checkouts/$id for each checkout 3. I cannot see any Biblio references in the returned data, so I’d have to then grab the biblio_id from the /items/$id endpoint and then call the /biblios endpoint to get the actual bibliographic data. If the patron had 10 items out this would be at least 30 calls to get the bib data. Is that what I would have to do, or am I missing something – like a header or extra query which would return all the info I require from the first endpoint call? Any advice/pointers would be much appreciated!! Cheers, Stephen -------------------------------------- Stephen Graham Library Technology Consultant Library and Computing Services University of Hertfordshire Hatfield, Hertfordshire, AL10 9AB Email: s.graham4@herts.ac.uk<mailto:s.graham4@herts.ac.uk> Website: herts.ac.uk _______________________________________________ Koha-devel mailing list Koha-devel@lists.koha-community.org<mailto:Koha-devel@lists.koha-community.org> https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel<https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel> website : https://www.koha-community.org/<https://www.koha-community.org/> git : https://git.koha-community.org/<https://git.koha-community.org/> bugs : https://bugs.koha-community.org/<https://bugs.koha-community.org/>
Hi Stephen, In the latest Koha version, we've added some additional x-koha-embed options to the patrons API: https://api.koha-community.org/Development.html#operation/listPatrons.. however from the looks of checkouts is just a count at the moment. We have to be a little careful will how much we expose using the embedding logic for performance reasons.. although it may seem counterintuitive, sometimes it's easier on the server to have multiple requests than to have a single large request with a lot of join logic internally. Hmm, having said that, it does look like a mistake to me that the /checkouts endpoint doesn't support 'items' being embedded yet.. and perhaps even 'items.biblio'.. I can look into that as a future addition. It'll need a little investigation to know to what extent we should expose embedding vs encouraging subsequent API calls for details. *Martin Renvoize, MPhys (Hons)* <https://www.ptfs-europe.com> Head of Development and Community Engagement *Phone:* +44 (0) 1483 378728 *Mobile:* +44 (0) 7725 985 636 *Email:* martin.renvoize@ptfs-europe.com www.ptfs-europe.com *Sign up for our newsletters here <http://eepurl.com/dPjjkn> or by scanning the QR code* Registered in the United Kingdom No. 06416372 VAT Reg No. 925 7211 30 The information contained in this email message may be privileged, confidential and protected from disclosure. If you are not the intended recipient, any dissemination, distribution or copying is strictly prohibited. If you think that you have received this email message in error, please email the sender at info@ptfs-europe.com On Tue, 12 Jul 2022 at 16:05, Stephen Graham <s.graham4@herts.ac.uk> wrote:
Thanks Arthur for the quick reply! I had totally forgotten about the ILS-DI interface. We do have it set up on our test server – so that is defiantly an option. We have written a custom endpoint for something else previously so maybe we should explore that avenue again to achieve what we want – I prefer the Oauth2 authentication I think.
Cheers, Stephen
*From:* Koha-devel <koha-devel-bounces@lists.koha-community.org> *On Behalf Of *Arthur *Sent:* 12 July 2022 15:15 *To:* koha-devel@lists.koha-community.org *Subject:* Re: [Koha-devel] Checkouts API Question
Hi Stephen,
Although it's quite old, the ILS-DI interface is still available in 21.11.
You can check the GetPatronInfo with "show_loans=1" parameter (perhaps by default?) to get the loans.
Then you also get bibliographic information about those loans in one API call.
However, ILS-DI is not secure by design, there is no authentication, which means, when you activate ILS-DI it is open to everyone to get personnal information on any of your patrons by scraping with random biblionumber, just be aware of this a put decent security (we use IP restriction which is not ideal but minimum required IMO)
Best,
Arthur Suzuki
Developper @BibLibre
On 12/07/2022 16:06, Stephen Graham wrote:
Hi All – we are on 21.11, and would like to include patron account data in our bespoke University mobile app. I was planning on using the RESTful API to get the data. What we would like is simply a list of titles (plus author and ISBN) along with the due back dates. I’m struggling , when looking at https://api.koha-community.org/21.11.html, to see how this could be done without using lots of API calls. Would I have to do something like the following:
1. Call /checkouts to get a list of checkouts from the patron 2. Iterate over the checkout_id and call /checkouts/$id for each checkout 3. I cannot see any Biblio references in the returned data, so I’d have to then grab the biblio_id from the /items/$id endpoint and then call the /biblios endpoint to get the actual bibliographic data.
If the patron had 10 items out this would be at least 30 calls to get the bib data. Is that what I would have to do, or am I missing something – like a header or extra query which would return all the info I require from the first endpoint call?
Any advice/pointers would be much appreciated!!
Cheers, Stephen
--------------------------------------
Stephen Graham
Library Technology Consultant
Library and Computing Services
University of Hertfordshire
Hatfield, Hertfordshire, AL10 9AB
Email: s.graham4@herts.ac.uk
Website: herts.ac.uk
_______________________________________________
Koha-devel mailing list
Koha-devel@lists.koha-community.org
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : https://www.koha-community.org/
git : https://git.koha-community.org/
bugs : https://bugs.koha-community.org/
_______________________________________________ Koha-devel mailing list Koha-devel@lists.koha-community.org https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel website : https://www.koha-community.org/ git : https://git.koha-community.org/ bugs : https://bugs.koha-community.org/
participants (3)
-
Arthur -
Renvoize, Martin -
Stephen Graham