# Setting path variables and POST body for Newman

**URL:** <https://community.postman.com/t/setting-path-variables-and-post-body-for-newman/48234>\
**Category:** Help Hub\
**Tags:** newman-project\
**Created:** [June 6, 2023, 9:15pm UTC](https://community.postman.com/t/setting-path-variables-and-post-body-for-newman/48234 "2023-06-06T21:15:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ba-tb](https://avatars.discourse-cdn.com/v4/letter/b/e9c0ed/32.png) [@ba-tb](https://community.postman.com/u/ba-tb)\
**Post date:** [June 6, 2023, 9:15pm UTC](https://community.postman.com/t/setting-path-variables-and-post-body-for-newman/48234/1 "2023-06-06T21:15:23Z")

</div>

> **Archived topic — this may be out of date.**  
> Newman has been replaced by the **[Postman CLI](https://learning.postman.com/docs/postman-cli/postman-cli-overview/)**, 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](https://github.com/postmanlabs/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](https://learning.postman.com/docs/), try the free [Postman tools](https://www.postman.com/tools) (no account needed), or join us on [Discord](https://discord.gg/58aNNsRBGR).

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:

```auto
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.

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [April 29, 2025, 2:13pm UTC](https://community.postman.com/t/setting-path-variables-and-post-body-for-newman/48234/2 "2025-04-29T14:13:20Z")

</div>

Closed on April 29, 2025, 2:13pm UTC


