cancel
Showing results for 
Search instead for 
Did you mean: 

Rest GET Pagination Issue

rahulkalyanwat
New Contributor

I am trying to read documents for REST GET snap and for specific ID i am having 918 records and I am only able to access starting 100 record and am not able to traverse next records. 

Sample response:

rahulkalyanwat_0-1693818719823.png

 

HAS NEXT and NEXT URL :

$entity.pageInfo.totalCount > 100*snap.out.totalCount

_BaseUrl+'/submgmt/api/v1/subscriptions/'+$ID+'/users?skip='+(100*snap.out.totalCount)+'&take=100'

rahulkalyanwat_1-1693818761217.png

 

7 REPLIES 7

chmurray88
New Contributor II

following. I have a similar issue, but no count, limit, start.

Hi @chmurray88! Am I understanding this correctly that you have an API that is giving you a page of responses, but you don't have any count, limit, start, or similar variables to work with? Are you able to cleanse the data content and show what your response looks like?

RogerSramkoski
Employee
Employee

Hello @rahulkalyanwat, what happens with the 'Has next' and 'Next URL' that you have configured? Does it give you an error, or just never runs again? The response screenshot with "startCount" = 101 makes me think you did fetch a second page of results so I just want to clarify that.

Next URL

I would also ask if you're using the 'REST Get' or 'HTTP Client' Snap? The latter might make this a bit easier for the 'Next URL'. The screenshot below shows a pagination setup I use against SnapLogic's API and you can see I don't have to work with the 'Next URL' at all since SnapLogic can piece it together for me - all that was needed in this situation was to override the 'offset' parameter. Based on what I can see from your override URL "skip" would be the only parameter to override and you could use a value like '$entity.startCount + $entity.limit'. 

 
 
 

rsramkoski_0-1693928677462.png

 

Has next

For the 'Has next' you could also use this expression so all the variables are based on values from the response instead of trying to use a static '100' and the internal 'snap.out.totalCount':

 

$entity.startCount + $entity.limit >= $entity.totalCount

 

 

Hi @RogerSramkoski  I am Using REST Get snap and Copied Screenshot of Second Page and can you please help me to calculate nexturl as well.

Page 1 response:

rahulkalyanwat_0-1693931135969.png

REST GET Snap HAS NEXT and NEXT URL:

 

rahulkalyanwat_1-1693931182285.png