Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

147
Views
Postman - conditionally running a request

When using Postman's Collection Runner and reading a csv file - I have two requests: A Get, and a Put. These requests are in their own folder and it's that folder that I'm kicking off Collection Runner from.

The response from the Get simply returns either true or false.

The Put Request flips this to false and that's it. So I thought it'd be easy enough:

var jsonInfo = pm.response.json();
console.log(data["AppId"] + " = " + jsonInfo);
if (jsonInfo === true)
{
    console.log("Setting " + data["AppId"] + " to false.");
    postman.setNextRequest("Change-AppID-Decision-to-False");    
}

Because I don't want the Put to run all the time, when using Collection Runner I have the Put unchecked. The Get kicks off, and I know it gets into the body of the if statement as it writes the statement to the console but the Put never runs after the Get request.

I'll concede that I could just run the Put since all the appId's that run through here need to be set to false but for my own knowledge I'm wondering if this is possible because it feels like it should be a simple and useful thing that Postman should be able to do :). Thoughts?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Because I don't want the Put to run all the time, when using Collection Runner I have the Put unchecked.

That does not work, as only checked Requests are considered by Postman Run.

But the fix should be as easy at to terminate the run:

postman.setNextRequest(null)

So your code should look like:

var jsonInfo = pm.response.json();
console.log(data["AppId"] + " = " + jsonInfo);
if (jsonInfo === true)
{
    console.log("Setting " + data["AppId"] + " to false.");
    postman.setNextRequest("Change-AppID-Decision-to-False");    
} else {
    console.log("Nothing to do now");
    postman.setNextRequest(null)
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!