Pagination in Kong Admin API

I can’t find anything related to pagination in docs. I am looking for a way to implement any of these pagination methods.
Seek Pagination like localhost:8001/routes?after_id=route_id
keyset pagination like localhost:8001/routes?created:lte:2019-01-20T00:00:00.

Plus can someone guide me to pagination section in the documentation.

The pagination rules are essentially:

  • If the results fit within one page, all the results are in that page
  • If the results don’t fit within one page, you’ll get some of the results, and the returned JSON will include a “next” key

For example, if I request consumers from one of my running Kong instances:

curl https:///consumers | jq
“next”: “/consumers?offset=”,
“data”: [

To request the next page, you would hit https://<whatever is in the “next” key>. That result can also include a “next” key, so on and so forth, so to iterate over all results you’ll generally need to loop on this.

Hope that helps.

1 Like