I have an interesting situation, which I am trying to solve without any success.
I am sending HTTP request, which could return anything from 1 to 5000 items in an array form. The problem is that if there are more than 200 items, it returns only 200, and then adds a link to another response with additional parameter: URL$skip=200
Right now, I have a ton of IF conditions, checking if the line with $skip is present, and running another request if it is present, while checking for another $skip=400/600/…/5000 in the outcome.
What I am trying to do is to identify the number of requests, which skip previous values, and iterate it as many times as needed.
I can run another request, which will provide the number of items which would be returned in the array, so I can easily calculate the total number of requests, by dividing the number by 200.
How would I be able to loop the execution until the number of iterations is met?
Right now, I am “recreating” the loop by numerous IF conditions, which isn’t the best way to address this problem.