Is it possible to impact Response Body before it is printed?

Hi,
Is it possible to impact response body so that I get only ceratain parts of the xml output. For example I have this xml file output:

and I would like it to be for example only this < entry >:

Without printing the rest of it.

Is it possible to do?

No as the response body is just that, the response that was sent back by the server.

You can’t change it or affect it like you can with the request body.

You can however use the tests tab to target elements in the response to print out in the console logs.

Or you can use the visualizer. You have more than one entry in your response so I’m guessing that you need the name for each entry, so this might be an option to consider.

Data Visualization for APIs | Postman Visualizer

If you need help with the visualizer, please post a full example response using the preformatted text option in the editor. (Redacted as appropriate).

2 Likes

Hi,
thanks for the hint with visualizer. It would work if I would be sending only one request. But I’m using a runner to go through csv file so I have many diffrent responses. From what I see there is no visualizer for runner. Only options are pretty and raw.

You could still use the runner, but instead of having your data on separate lines within the CSV, just have it on one line saved as an array.

Or just save the data from the CSV in a collection variable as an array.

You can then use the array.shift() and setNextRequest() method to loop through the array.

What you can then do, on each iteration, is save the relevant information to a new object with just the key/values you want to show in the Visualizer.

When the array gets to zero entries, you would then set the visualizer template with that object.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.