How to export/download Response Body into an external file from Postman Collection Runner Results

postmanpostman-collection-runner

I am working on a project where I have to hit a web service multiple times with different values of a variable

For example, http://mywebservice.com?variable1={{value}}

and different values are passed using Postman collection runner.

I want to download the response body of all the requests into a file. How do I do that?

Best Answer

I don't think you can download the response body of the request in the collection runner - You can export the test results but i'm not sure that this contain the response body data. You can also click on each request in the runner and see the response body but this is still all within the UI.

For individual requests you can use the Send and Download option, which will show you the response body:

enter image description here

I'm sure there is some workaround that you could do to save the response body as an environment or global variable and then export this after but it seems like an awkward and slightly hacks solution.

pm.globals.set('response_body', JSON.stringify(pm.response.json()))

This would get overwritten each time though, so you would need to change the variable name each time, or have something in your code to change its name, to get a unique set of them.

These can then be exported and saved locally using the Manage Environment section.

Related Topic