Hi Personally I'd go for b). Specifying an offset and limit is (in my experience) easier than trying to keep track of what "page" you're on and getting the next "page".
If result metadata is to be returned, as demonstrated in c), would this not be better passed in the response headers as it's not actually part of the resource being returned? Cheers Andrew -- Andrew Isherwood Senior Architect - rebus:list PTFS Europe Limited Content Management and Library Solutions email: andrew.isherw...@ptfs-europe.com web: http://www.ptfs-europe.com/ On 24 August 2017 at 15:50, Tomas Cohen Arazi <tomasco...@gmail.com> wrote: > Hi there, I'm currently implementing a couple endpoints for > acquisitions-related stuff and also QAing existing patches introducing > endpoints. > > One of the things that need to be done (which I did for my own endpoint for > vendors / bug 18120) is migrating them to Mojolicious::Plugin::OpenAPI > instead of (the deprecated) Mojolicious::Plugin::Swagger2. > > I noticed there's lack of a generic way to deal with pagination. There are a > couple options we could consider, but I would like to hear the opinion of UI > people, which are the ones that will take advantage or suffer what we do on > the backend :-D > > a) GET /patrons?page=1&per_page=3 => [ {borrower1}, {borrower2}, > {borrower3} ] > b) GET /patrons?offset=0&limit=3 => [ {borrower1}, {borrower2}, {borrower3} > ] > > Lari proposed another one, which tackles an issue we could have on the UI > (knowing the total, calculating pages, etc): > > c) GET /patrons?page=1&per_page=3 { total: 50000, results: [ {borrower1}, > {borrower2}, {borrower3} ] } > > (c) has the problem that it would mean we need to change the current > resposes for list operations on the already implemented endpoints. I'm not > sure at this point we would need to shift api version (v2?), I would vote > against, but here we have the chance to hear people using the API. > > Looking forward to your comments as my current dev work completion depends > on it :-D > > -- > Tomás Cohen Arazi > Theke Solutions (https://theke.io) > ✆ +54 9351 3513384 > GPG: B2F3C15F > > _______________________________________________ > Koha-devel mailing list > Koha-devel@lists.koha-community.org > http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel > website : http://www.koha-community.org/ > git : http://git.koha-community.org/ > bugs : http://bugs.koha-community.org/ _______________________________________________ Koha-devel mailing list Koha-devel@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/