Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

148
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda