cancel
Showing results for 
Search instead for 
Did you mean: 

HTTP client

rjapala
New Contributor III

**Task :**We have n number of records in the below URL, we have to pull all the records. For each request there should be limit of 10 records for testing.

How to use Pagination for this Task,

Note: In my client URL there is no offset, start or limit.

For Example:
First request 0-10
Second request 11-20

It should take dynamically the next 10 records for each request and send for testing.

Please help me on this task and how to use pagination concept.

Thanks in advance !!

@ddellsperger @dmiller

8 REPLIES 8

Thanks for the reply @ddellsperger . Odd that I didn't get a email notification with your update. I checked the notification settings and they all look right. Odd.

Anyways...I tried the above and there is no paging "level" in my response...it just goes $entity.records....I've emailed the guys that built the API to ask them about a cursor parameter as their documentation doesn't mention one. I will circle back. 

Do you know maybe where the cursor information is, as long as you can see the cursor somewhere in the response, you should be able to work through that (feel free to reach out via message if you want to take a look at it together)

@maheswara - 

@ddellsperger was able to help me get this resolved. If you do not have an offset, limit, or start in the JSON response anywhere AND the pagination type is "cursor", you can do the following settings in your HTTP snap and this will get you all the records.

- Has next: $entity.records.length != 0 (your $entity.records might be different depending on how your JSON response looks. This is just the location where your data is located)

- check the check box for "Reuse request parameters."

- Override parameters: my API had a query parameter called objectsBefore that I could use. For the name I did objectsBefore, value was $entity.records[$entity.records.length - 1].id (basically what this is doing is getting the LAST record in the array and using that as the objectsBefore value then to page to the next set of records)

 

- Chris

 

@ddellsperger 

I am trying to implement cursor based Pagination using HTTP Client snap. We could get the startCursor, endCursor, hasNextPage values of the page in the JSON response. 

However, in the Reuse Request Parameter section, I am unable to access the endCursor value. When I provide the expression as $.entity.data... it throws the error as "entity not defined". 

Any help on fixing this is much appreciated.