Setting path variables and POST body for Newman

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.

I am stuck. I am trying to automate some API tests, and I cannot figure out how one would pass a path variable to Newman. For example, I have a PUT to /accounts/:accountId where :accountId is the account ID I want to modify.

And then, how can I supply a POST body to update the target resource?

Additional context: I imported my collection from a Swagger doc, and I intend to keep doing this in a custom pipeline. Edit: I included this because I see some people have Postman style variables in their paths, but I don’t because I’m bringing in a Swagger doc.

Edit: This seems to work for path params, but feels wrong:

const id = 60;
pm.request.url.path = '/accounts/' + id;

Kind of crazy that I can overwrite the path, but I can’t find a built in way to replace a path var.