Forum Discussion
Rest api call with multiple pages
Hello,
I need to migrate an SSIS package that make API calls and return multiple pages.
The call goes to https://{{HOSTNAME}}/personnel/v1/person-details, and I can manually do https://{{HOSTNAME}}/personnel/v1/person-details?page=1&per_page=200, my issue is that I do not get any metadata to create the rules on the foreach loop on the first call, and I am not sure how to go about it
I get something like this, no metadata
[
{
"additionalName1": null,
"additionalName2": null,
"nationality1": null,
"nationality2": null,
"nationality3": null,
},
{
"additionalName1": null,
"additionalName2": null,
"nationality1": null,
"nationality2": null,
"nationality3": null,
},
{
"additionalName1": null,
"additionalName2": null,
"nationality1": null,
"nationality2": null,
"nationality3": null,
}
]
1 Reply
- petevernBrass Contributor
How about using an until activity until the response is empty.
Variables:
- CurrentPage = 1 (starting page)
- ReponseHasData = trueUntil Activity
- Condition is ResponseHasData = true
- In the loop:
* Make API call using dynamically generated URL that includes CurrentPage
* Check the response length:
- If the response array is empty set ResponseHasData = false, which exists the loop
- otherwise increment ResponseHasData by 1 and continue looping