Archived topic — this may be out of date.
Newman has been replaced by the Postman CLI, Postman’s official, signed command-line tool. It runs collections as Newman did, and also lints API specs, runs mocks and monitors, and syncs local files with Postman from your terminal, CI/CD pipeline or coding agent.
Working with an AI coding agent? The Postman plugin lets agents in Claude Code, Cursor, Codex and others design, mock, test and ship APIs with Postman.
For current help, see the Postman docs, try the free Postman tools (no account needed), or join us on Discord.
Its possible to save the body results to a CSV or JSON file, using newman?
Newman is in essence a CLI collection runner, so if you are referring to downloading the results of a collection run onto a json file you can run the following commands on the CLI:
newman run mycollection.json --reporters cli,json --reporter-json-export outputfile.json
To export the results onto a CSV file, you can download the reporter from the following link and enter the appropriate command on the CLI:
But based on the screenshot, I am pretty sure you are referring to capturing the response body of a particular request and exporting it into a JSON file, for that particular use case, you can click on the arrow next to the “Send” button as shown in the attached image and then click on “Send and Download” to download the JSON response body as a JSON file onto your system.
Yes, you are correct, I need “response body of a particular request and exporting it into a JSON file” but I need this automatic in newman… its possible?
I’m running the command “newman run Get_MRS_Incidents.json --reporters cli,json --reporter-json-export outputfile.json”
The short answer would be that you cannot run a single request on Newman and export the results to a JSON file as Newman runs collections and not requests.
One workaround would be to create a collection, add the single request you require under that collection and run the Newman command for the exported collection. Although this is not a very effective use of Newmans capabilities.
This code seems to work fine for me and the files are created with the data. It would have created those files in the same directory as you ran the script.
You could add this to the writeFile function to log the file path:
console.log(`File Created in this dir: ${process.cwd()}`);
There also could be all sorts of environmental things happening here with the version of node, the version of Newman, the installation method of the npm package, the package.json file, the permissions to write files into that dir, etc.
vdespa - Your suggestion was spot on. That request had no “body”. I changed that to args.request.url.toString() and all works perfectly. Thank you so much. As a very new newbie to all this…your videos have been invaluable. So I thank you for those as well!
When I run the script it overwrites the previously saved request and response. By the end of the collection run, it saves the last iteration request and response…
But, I would like to save each and every iteration request and response instead of only saving the last iteration run request and response.
Suppose in a collection i have 5 requests & we have saved the response in external disk of all these 5 request. But the file name in which response saved should be equal to request name So, how can we do that ? Is there any replica of postman function - console.log(request.name) ? functionality in newman ?
Again, I’ve used the Postman Echo Collection and reduced this down to just run the Request Methods folder. I also created a results folder to save the files into.
Each of those files contains the JSON response body from that request.
I was doing a little brainstorm & trying not to hardcode the requestName in postman UI (In attached screenshot request Name is login) & trying to pass the requestName from my external csv file.
Challenges :
How can i assign the value present in csv file to requestName in postman script section OR via newman ? Is this possible via postman for requestName ?