PDA

View Full Version : Pagination in the REST API



Clive Richmond
21-Jul-2020, 10:40 AM
Just wondering if anyone has implemented a pagination system in their REST services e.g.



http://localhost/WebOrder_19_1/customerAPI/customers?page=2

Mike Peat
21-Jul-2020, 11:05 AM
Clive

I actually built a way to do something like this into my RESTLibrary, but without checking quite a bit I can't remember the exact mechanism...

It was something like:


http://localhost/WebOrder_19_1/API/customers?start=21&limit=20


Which (maybe if you'd put a bit of extra work in I suspect) would return customer rows from 21 to 40 in the list. Doing it with page=x would require also specifying a page size in rows (which could also be implemented). I know I demoed it doing something like this, maybe in Edinburgh.

Mike

starzen
21-Jul-2020, 11:40 AM
yes we do. you want to pass the page size and page number. with sql statements paging is very easy to implement

Clive Richmond
22-Jul-2020, 10:18 AM
Hi Mike,


I actually built a way to do something like this into my RESTLibrary, but without checking quite a bit I can't remember the exact mechanism...

If I had turned the page (page 6) I would have found exactly what you described. :o

Thanks.

Clive Richmond
22-Jul-2020, 10:21 AM
Hi Michael,


yes we do. you want to pass the page size and page number. with sql statements paging is very easy to implement

Thanks for the tip. Is there any SQL code you are able to share?