adityamohanty
2 years agoNew Contributor II
Running Rest API in a loop where Page count is fixed variable
Step -1
Rest API to get the collection info looks like
https://stage-data.xyz.com/v1/xyz-api/collections/models/info?page_size=100
Output:
{
"total_count": 5099,
"page_count": 51,
"page_size": 100
}
Step -2
Rest API to get the model looks like
Output:
It will give model information of 1st page with 100 records.
Question - I want to run it 51 times (based on page count) in a loop to load entire records
Solution:
I captured the page count & total count through mapper and my Get Rest Snap looks like
HTTP Header : As per Need
Has next : snap.in.totalCount == $page_count
Next URL: "https://stage-data.xyz.com/v1/xyz-api/collections/models/" + (snap.in.totalCount + 1) + "?page_size=100" + '?skip=' + (snap.in.totalCount + 1).toString()
I am able to load only 100 records to my target. Please advise
But if those numbers are between quote it means that it is string.
723456 and “723456” is not same.
See if this will help you to determine if it’s number or string.
$input.toString().match(/^\d+$/) != null ? true : false
This expression will check if value of input contains only numbers and if it is, then will return true, otherwise if not contains only numbers it will return false.
To check for string it’s opposite, you need to switch the places of true and false.
Regards,
Viktor