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

81
Visualizações
I need send request looping with a array list

When I finish one request I'm creating an array in the collectionVariables to store an Id that come from response. Then I need use this array to send request to delete all my content

(storing the id)

const idArray = pm.collectionVariables.get("idArray2");
response = JSON.parse(responseBody);
// const array = [];
const id = response.items[0].sys.id;
// array.push(id);
// entryId = pm.response.json().items[0].sys.id;
idArray.push(id);
// arrayValue = pm.collectionVariables.get("idArray");
console.log(idArray);
// pm.collectionVariables.set("arrayValue", array);
// arrayValue.push(id);

To delete this contents I need to loop with forEach function. For it I need set the arrays info in the {{ID}} endpoint

var submitUnpublishedRequest = {
        url: pm.variables.replaceIn('https://api.contentful.com/spaces/{{spaceId}}/environments/{{branch}}/entries/{{ID}}/published'),
        method: 'DELETE',
        header: {
            'Authorization': "Bearer " + pm.environment.get("contentManagementToken"),
            'aeg-event-type': pm.environment.get("event_type"),
            'aeg-sas-key': pm.environment.get("sas_key"),
            'Content-Type': "application/json"
        },
        body: {}
    } 
 pm.sendRequest(submitUnpublishedRequest)

My question is, how can I loop this pre-request to delete my content ?

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