12-12-2018 07:36 AM
Hello,
I am trying to load transaction data from a REST API end point. The API has pagination as required Input parameter. I am using the REST GET to fetch the data and the Https URL should be as below.
https://xxxxxx–xxx/transactions?datestart=2018-11-19T00:00:00&dateend=2018-11-20T00:00:00&pageSize=1000&pageNo=1.
I am trying to design a process which loops thru till the REST API call returns null data set.
For example, if the above REST URL gives output, I have to call the same URL again with the pageNo input parameter as 2 and if it provides a data set, then 3 and on and on. The loop has to end when the REST API comes out with a null data.
Any help to solve this would be highly appreciated and also would like to know if looping is the only option and right approach.
Thanks
Aravind N
12-12-2018 09:37 AM
Is this is a duplicate of How to Access data from an REST API which has pagination as input parameters?
12-12-2018 09:42 AM
It’s in the line of same Topic. But i was trying to see if i can loop thru the REST GET Snap (even using any external code like python).
12-12-2018 02:57 PM
The REST GET have a build in pagination feature. Please review Example #4, 5 & 6 in the REST GET documentation.
12-17-2018 11:28 AM
Based on the Example 4 of the REST GET documentation, I tried to use the solution but getting errors. Attached is the screenshot of the REST GET snap which is used in my pipeline.
The scenario for my REST GET is mentioned below. The API URL has a header key for authorization as mentioned in the screenshot.
https://xxxxxx–xxx/transactions?datestart=2018-12-16T00:00:00&dateend=2018-12-17T00:00:00&pageSize=1000&pageNo=1
If the above URL has response with data, then the below should be triggered
https://xxxxxx–xxx/transactions?datestart=2018-12-16T00:00:00&dateend=2018-12-17T00:00:00&pageSize=1000&pageNo=2
If the above URL has response with data, then pageNo gets incremented until there is no data returned for the API.
The Has next attribute is set as “$entity.Items[*].length > 0” as i am checking the condition if the API returns any data. But the expression is failing.
Also the Next URL is set in such a way that it takes the input parameter along with the incremental value for pageno. Does this need to have the Header Authorization Key in the call? Please advise and help.
Thanks
Aravind N