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

132
Visualizações
Extract Information from Response Body Postman

I'm trying to acquire two fields of information of a response body from a VTEX API.

In tests, I currently have: tests[` ${responseBody}`] = true;

In return I receive:

[{"categoryId":"default","categoryName":"null","categoryFullPath":null,"productCommissionPercentage":12.00,"freightCommissionPercentage":12.00}]

I'm looking to extract productCommissionPercentage and freightCommissionPercentage numbers from a list of sellers that I upload via postman runner.

The uploaded CSV looks like this:

sellerId

xxxx

yyyy

zzzz

I'm looking to have in return something like this, the intent is to easily keep track of seller commisions

sellerId productCommissionPercentage freightCommissionPercentage 
    
xxxx     10                          12
    
yyyy     12                          8
    
zzzz     11                          10
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can access the response json in your tests via pm.response.json() if that's all you're looking for.

If you want to display the results as a table, add the following to your request's Tests section:

var template = `
<table bgcolor="#FFFFFF">
    <tr>
        <th>sellerId</th>
        <th>productCommissionPercentage</th>
        <th>freightCommissionPercentage</th>
    </tr>
    
    {{#each response}}
        <tr>
            <td>{{sellerId}}</td>
            <td>{{productCommissionPercentage}}</td>
            <td>{{freightCommissionPercentage}}</td>
        </tr>
    {{/each}}
</table>
`;

// Set visualizer
pm.visualizer.set(template, {
    // Pass the response body parsed as JSON as `response`
    response: pm.response.json()
});

This assumes the response contains the sellerId as a field as well. If it doesn't, you'll need to match it with the ids from your request body, assuming they're in the same order.

about 4 years ago · Juan Pablo Isaza Relatório
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