Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

183
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda