Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

123
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!