REST GET: Has Next And Next URL

I can’t find any good documentation on how to set this up. I have reviewed this article and I am still stuck

https://www.snaplogic.com/blog/rest-get-and-the-snaplogic-public-apis

The json returns the values below. I need to increment the page by one until I get all the values.

2018-07-27_12-52-05

This is the pipeline I have set up.

2018-07-27_12-55-59

In the mapper I do this: (Based on article link above)

Here is the REST GET Snap

I just don’t know how to get these variable back to the Rest GET

@jhagist
The logic for has next is to evaluate this expression and if it’s true then make a new get request using value in next url field. Assuming your every request gets you 1000 records in one page. So if you have more than 1000 records then you have to make another request by incrementing the page parameter by 1. According to the given example, 369 requests will bring 369000 records. To get the remaining number of records, 397th get request will be required and $entity.get(‘pageSize’) will return 822 records and this condition will fail. I hope this helps.

  1. has next = $entity.get(‘pageSize’) == 1000

  2. next url = “https//secure.p03.eloqua.com/API/rest/2.0/data/accounts?count=1000&page=” + str(snap.out.totalCount+2)

@jhagist & @bhupender.singh

Hi James and Bhupender,

James – were you able to get this to work?
We are running into the same situation.
Can you confirm that the “has next” can take values that were returned by the initial get?

Our api returns entity.pageNumber & entity.totalPages. Our thought was to have this for the “has next”:
$entity.pagerNumber < $entity.totalPages.

This should be valid, right?

Also, for the next url we were going to use “$entity.pageNumber + 1” to set the page requirement. Is this valid?

Any direction you can provide would be great. I’ll provide some screen shots if needed.
Thanks!

Bob

Sorry for not finishing this one out.

You are correct. The “has next” must pull it’s values from the API response.

I believe that $entity.pagerNumber < $entity.totalPages. should work for you. To test it put a mapper after the Rest Snap to see what results you are getting.

This should work too. “Also, for the next url we were going to use “$entity.pageNumber + 1” to set the page requirement. Is this valid?” once again add this to the mapper to see if your logic is correct.

This is a screen shot of my working snap. Some of it is parameters or variables captured earlier in the pipeline but you should get the idea.

One note. “Next URL”. You will notice that I have added variables to it. I mistakenly thought the ones set above would apply but that is not the case. You need to rebuild it manually .

FYI: This is an example from Eloqua. The out of the box does not work for the bulk API.