Hi,
Need some info over how we can use pm.execution.setNextRequest() to perform recursion while traversing thru all pages of a postman response.
Work flow:
-
Request Body:
{
“page_type”: “FIRST”,
“limit”: 200,
“cursor”: {{cursorval1}},
“default_filter”: “”
} -
cursorval1 is the collection variable which holds the data value to traverse thru all the pages.
-
In post response script, cursorval1 is set using = pm.collectionVariables.set(“cursorval1”, body.next_cursor)
-
To recurse through all the pages, I am using pm.execution.setNextRequest(id) in a while loop and the id passed is the same as request which is calling the post response script (This is not a separate script)
-
Need to know if on calling pm.execution.setNextRequest(id) till a certain response data condition is met, does it overwrite the pm.response.json()
-
It appears to me that even if we call the pm.execution.setNextRequest(id) in a loop it does not overwrite the first json response we get pm.response.json()
-
Is there any other way to perform recursion of a request using the post response script of the same request