Branching and LoopingIn Postman, we can also work on branching and looping. We can branch and loop across API requests with the help of setNextRequest() function. This function is used to set the request to be executed next. This function takes one argument, i.e., the name of the request, which will execute next. In the above example, "My API" is the name of the request. Some features of setNextRequest():
Loop Over the Current RequestIf you give the currently running request name in the argument of setNextRequest() function, then Postman will run the same request continuously. But when you are continuously looping along with the same request, we have to apply some logic on setNextRequest() so that the request won't run endlessly; the collection runner will otherwise have to be force closed. Stop Workflow ExecutionTo stop the execution of workflow pass the null argument in setNextRequest() function. Next TopicPostman Tutorial |