Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

REST Api pagination

Hello,

I am wondering if you can help me with api pagination... I am trying to get all records from an external api but it restricts me with only getting maximum of 10. There are around 40k records..
The api also does not shows "no.of pages". hence i cant get my head around a solution.
There is no "skip" or "count" or "top" supported either.. i am stuck...

 

Below is my code.

 

and below is output

 

15 Replies

  • Most likely that site allows GET parameters or POST payloads specifying the page number, and a larger amount of results per page. Do they provide any type of API documentation?

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks for you reply... They only allow page numbers in the "body" and the maximum is 10 records by default. dont allow to fetch more.

       

      • lbendlin's avatar
        lbendlin
        Super User

        Fair enough.

         

        1. Run the initial query and fetch the totalCount value

        2. Generate a series of page numbers from 2 to TotalCount/10

        3. add the page number to your content payload and fetch the individual results

        4. combine with the result from page 1 (step 1)

  • Anonymous's avatar
    Anonymous
    Not applicable

    lbendlin I have updated my previous reply.. Thank you

  • what happens on  [key="status", operator="EqualTo", value="Active", page=2resultType="full"]  ?

      • lbendlin's avatar
        lbendlin
        Super User

        Good. That means you can implement my proposed approach. How long does it take to fetch 10 records? You'll have to do that 4000 times...