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

179
Vistas
Looping until next request has number of results greater than 0 in postman

I am trying to find a proper way in postman to iterate between 2 requests until certain criteria is matched.

I have a GET /categories request where it gives you bunch of categories and I have another request Get /PLP. However in certain cases PLP get empty list making tests to failed because categories we store in variable is empty.

The thing I was trying was on /GET PLP requests, in pre-requisite script I am sending GET PLP request and checking if it is empty or not, if its empty I was setting postman.setNextRequest("Categories") so that it loops around until PLP is not empty. However this is not working for me. Has anyone have any idea how to solve it or have different approach. Below is my prerequisite script

var jsonData;

pm.sendRequest({
    url: pm.environment.get('url') + "categories=" + pm.environment.get('subCategoryId'),
    method: 'GET',
    header: {
        'content-type': 'application/json', 
    }
}, function (err, response) {
    if (err) throw new Error(err);
     var jsonData = response.json().numberOfItems;
     console.log(jsonData)

});

if (jsonData == 0) {
    postman.setNextRequest("Categories");
}
about 4 years ago · Juan Pablo Isaza
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