A new request with request id 8072 has been created by koha-devel-request@lists.koha-community.org. Short info on the request is :
Title : Koha-devel Digest, Vol 201, Issue 9
Category :
Description : Send Koha-devel mailing list submissions to
koha-devel@lists.koha-community.org
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
or, via email, send a message with subject or body 'help' to
koha-devel-request@lists.koha-community.org
You can reach the person managing the list at
koha-devel-owner@lists.koha-community.org
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Koha-devel digest..."
Today's Topics:
1. Re: Getting "count" when using REST API (Renvoize, Martin)
2. Re: Getting "count" when using REST API (Tomas Cohen Arazi)
----------------------------------------------------------------------
Message: 1
Date: Fri, 5 Aug 2022 15:42:29 +0100
From: "Renvoize, Martin" <martin.renvoize@ptfs-europe.com>
To: dcook@prosentient.com.au
Cc: Tomas Cohen Arazi <tomascohen@gmail.com>, Koha Devel
<koha-devel@lists.koha-community.org>, Jonathan Druart
<jonathan.druart@gmail.com>
Subject: Re: [Koha-devel] Getting "count" when using REST API
Message-ID:
<CAB7SL8DSQ6yHF5PKjQbPwaHo2cQxHWLVmAOoB1kij_KNhd_FtA@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
We should probably implement this as a HEAD request.. i.e. instead of doing
a special ?_page=1&_per_page=1, we should just allow requesting the HEAD on
whatever the request was and then you can read the X-Total-Count header..
in the Koha side we can handle such a request with performance in mind and
not both fetching all the data to return etc.
*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 Fri, 5 Aug 2022 at 01:31, <dcook@prosentient.com.au> wrote:
> How do you mean?
>
>
>
> In my case, I’m improving how my Keycloak User Storage extension works
> with Koha. It fetches the count of users and then sends an API request
> using an offset and that count to handle the paging. Their internal API
> breaks it into 2 steps, so I have to hit the database twice anyway.
>
>
>
> David Cook
>
> Senior Software Engineer
>
> Prosentient Systems
>
> Suite 7.03
>
> 6a Glen St
>
> Milsons Point NSW 2061
>
> Australia
>
>
>
> Office: 02 9212 0899
>
> Online: 02 8005 0595
>
>
>
> *From:* Tomas Cohen Arazi <tomascohen@gmail.com>
> *Sent:* Friday, 5 August 2022 10:26 AM
> *To:* David Cook <dcook@prosentient.com.au>
> *Cc:* Jonathan Druart <jonathan.druart@gmail.com>; Koha Devel <
> koha-devel@lists.koha-community.org>
> *Subject:* Re: [Koha-devel] Getting "count" when using REST API
>
>
>
> That's a smart trick!
>
>
>
> We should not be lazy though, and add a generic way to retrieve the count
> without making several DB hits.
>
>
>
> El jue, 4 ago 2022 20:56, <dcook@prosentient.com.au> escribió:
>
> Jonathan, you are a champion! That'll work perfectly for me!
>
> David Cook
> Senior Software Engineer
> Prosentient Systems
> Suite 7.03
> 6a Glen St
> Milsons Point NSW 2061
> Australia
>
> Office: 02 9212 0899
> Online: 02 8005 0595
>
> -----Original Message-----
> From: Jonathan Druart <jonathan.druart@gmail.com>
> Sent: Thursday, 4 August 2022 10:17 PM
> To: Tomas Cohen Arazi <tomascohen@gmail.com>
> Cc: David Cook <dcook@prosentient.com.au>; Koha Devel <
> koha-devel@lists.koha-community.org>
> Subject: Re: [Koha-devel] Getting "count" when using REST API
>
> I needed that for ERM and I did a GET with _page=1 and _per_page=1 (to
> retrieve only 1 result) then read the X-Total-Count value from the header's
> response ;)
>
> Le jeu. 4 août 2022 à 12:33, Tomas Cohen Arazi <tomascohen@gmail.com> a
> écrit :
> >
> > Only with x-koha-embed
> >
> >
> > El jue, 4 ago 2022 3:54, <dcook@prosentient.com.au> escribió:
> >>
> >> Hi all,
> >>
> >>
> >>
> >> Is there a method for getting a “count” using the REST API without
> fetching every record?
> >>
> >>
> >>
> >> When building a paging lookup outside of Koha, it would be useful to
> get a total record count and then just fetch the page of records that you
> need.
> >>
> >>
> >>
> >> Thanks!
> >>
> >>
> >>
> >> David Cook
> >>
> >> Senior Software Engineer
> >>
> >> Prosentient Systems
> >>
> >> Suite 7.03
> >>
> >> 6a Glen St
> >>
> >> Milsons Point NSW 2061
> >>
> >> Australia
> >>
> >>
> >>
> >> Office: 02 9212 0899
> >>
> >> Online: 02 8005 0595
> >>
> >>
> >
> > _______________________________________________
> > 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/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.koha-community.org/pipermail/koha-devel/attachments/20220805/01889cfd/attachment-0001.htm>
------------------------------
Message: 2
Date: Fri, 5 Aug 2022 12:15:04 -0300
From: Tomas Cohen Arazi <tomascohen@gmail.com>
To: "Renvoize, Martin" <martin.renvoize@ptfs-europe.com>
Cc: David Cook <dcook@prosentient.com.au>, Koha Devel
<koha-devel@lists.koha-community.org>, Jonathan Druart
<jonathan.druart@gmail.com>
Subject: Re: [Koha-devel] Getting "count" when using REST API
Message-ID:
<CABZfb=WE8MT+5n4OO8EfDr0zAU7yDmd+e8kUu48oE4bQU4YzxQ@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
I'll file a bug for that. I'm thinking we could reconsider the return value
for objects.search at this point (i.e. just return the resultset and let
the controller call ->to_api). It feels it would be more consistent too.
Nice one!
El vie, 5 ago 2022 11:42, Renvoize, Martin <martin.renvoize@ptfs-europe.com>
escribió:
> We should probably implement this as a HEAD request.. i.e. instead of
> doing a special ?_page=1&_per_page=1, we should just allow requesting the
> HEAD on whatever the request was and then you can read the X-Total-Count
> header.. in the Koha side we can handle such a request with performance in
> mind and not both fetching all the data to return etc.
>
> *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 Fri, 5 Aug 2022 at 01:31, <dcook@prosentient.com.au> wrote:
>
>> How do you mean?
>>
>>
>>
>> In my case, I’m improving how my Keycloak User Storage extension works
>> with Koha. It fetches the count of users and then sends an API request
>> using an offset and that count to handle the paging. Their internal API
>> breaks it into 2 steps, so I have to hit the database twice anyway.
>>
>>
>>
>> David Cook
>>
>> Senior Software Engineer
>>
>> Prosentient Systems
>>
>> Suite 7.03
>>
>> 6a Glen St
>>
>> Milsons Point NSW 2061
>>
>> Australia
>>
>>
>>
>> Office: 02 9212 0899
>>
>> Online: 02 8005 0595
>>
>>
>>
>> *From:* Tomas Cohen Arazi <tomascohen@gmail.com>
>> *Sent:* Friday, 5 August 2022 10:26 AM
>> *To:* David Cook <dcook@prosentient.com.au>
>> *Cc:* Jonathan Druart <jonathan.druart@gmail.com>; Koha Devel <
>> koha-devel@lists.koha-community.org>
>> *Subject:* Re: [Koha-devel] Getting "count" when using REST API
>>
>>
>>
>> That's a smart trick!
>>
>>
>>
>> We should not be lazy though, and add a generic way to retrieve the count
>> without making several DB hits.
>>
>>
>>
>> El jue, 4 ago 2022 20:56, <dcook@prosentient.com.au> escribió:
>>
>> Jonathan, you are a champion! That'll work perfectly for me!
>>
>> David Cook
>> Senior Software Engineer
>> Prosentient Systems
>> Suite 7.03
>> 6a Glen St
>> Milsons Point NSW 2061
>> Australia
>>
>> Office: 02 9212 0899
>> Online: 02 8005 0595
>>
>> -----Original Message-----
>> From: Jonathan Druart <jonathan.druart@gmail.com>
>> Sent: Thursday, 4 August 2022 10:17 PM
>> To: Tomas Cohen Arazi <tomascohen@gmail.com>
>> Cc: David Cook <dcook@prosentient.com.au>; Koha Devel <
>> koha-devel@lists.koha-community.org>
>> Subject: Re: [Koha-devel] Getting "count" when using REST API
>>
>> I needed that for ERM and I did a GET with _page=1 and _per_page=1 (to
>> retrieve only 1 result) then read the X-Total-Count value from the header's
>> response ;)
>>
>> Le jeu. 4 août 2022 à 12:33, Tomas Cohen Arazi <tomascohen@gmail.com> a
>> écrit :
>> >
>> > Only with x-koha-embed
>> >
>> >
>> > El jue, 4 ago 2022 3:54, <dcook@prosentient.com.au> escribió:
>> >>
>> >> Hi all,
>> >>
>> >>
>> >>
>> >> Is there a method for getting a “count” using the REST API without
>> fetching every record?
>> >>
>> >>
>> >>
>> >> When building a paging lookup outside of Koha, it would be useful to
>> get a total record count and then just fetch the page of records that you
>> need.
>> >>
>> >>
>> >>
>> >> Thanks!
>> >>
>> >>
>> >>
>> >> David Cook
>> >>
>> >> Senior Software Engineer
>> >>
>> >> Prosentient Systems
>> >>
>> >> Suite 7.03
>> >>
>> >> 6a Glen St
>> >>
>> >> Milsons Point NSW 2061
>> >>
>> >> Australia
>> >>
>> >>
>> >>
>> >> Office: 02 9212 0899
>> >>
>> >> Online: 02 8005 0595
>> >>
>> >>
>> >
>> > _______________________________________________
>> > 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/
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.koha-community.org/pipermail/koha-devel/attachments/20220805/51f6af90/attachment.htm>
------------------------------
Subject: Digest Footer
_______________________________________________
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/
------------------------------
End of Koha-devel Digest, Vol 201, Issue 9
******************************************
NOTE: You are receiving this mail because, the Requester/Technician wanted you to get notified on this request creation.