Need to add timeout in loop

Hi All,

Can you please help me to write a test in postman such that whenever I fire an API and if it is not giving response within 30 minutes, I need to exit/skip the service using loop.

Thanks in advance


Are you saying that you want the request you are making to timeout after 30 minutes?

Where is this loop coming into play?

You could set this value in Settings to 1800000 if you just want it to timeout and abort

I have written an condition such that when ever the status of the API is completed, I will be hitting the same API continuously. But my problem is what happens if the API is taking too much time to get the status of API as completed…?

In order to overcome, I need to write a condition if my API is taking too much time to give the status as complete, I need to skip the execution of entire collection. can you please help me to do that.


In the first request of your collection, you need to initialize a “start time” variable.

Then in your request that checks the status, you would also check to see the time difference between now and when that start time variable was set. If the time difference is outside of the 30 minute threshold, you can use postman.setNextRequest('last request in your collection') to jump to the end of the collection and stop execution. You would just replace ‘last request in your collection’ with the actual name of the request.

Does that make sense?