post image :date_long | 1 min Read

newman

newman run \
-d postman/vlans-post.json \
--reporters=cli,htmlextra  \
--env-var access_token=$TOKEN \
--folder '/vlans-post' \
--reporter-htmlextra-export newman/network.html  \
--verbose  postman/postman_collection_v5.json

I have a collection in Postman which loads “payload objects” from a json file and want to make it run in newman from command like.

POST request

Body: of POST request I have got {{jsonBody}}

Pre-request Script: logically pm.globals.set("jsonBody", JSON.stringify(pm.iterationData.toObject()));

and a file.json file with this kind of “objects”:

[
    {
    "data": {
        "propert1": 24,
        "property2": "24__DDL_VXS",
        ...
    },
        {
    "data": {
        "propert1": 28,
        "property2": "28__HDL_VDS",
        ...
    }
...
]

Works like a charm in Postman.

Here is what I’m trying to run in cmd.

newman run \
-d file.json  \
--env-var access_token=$TOK4EN \
--folder '/vlanspost' \
postman/postman_collection_v2.json

Based on the results I am getting - it looks like

author image

Jan Toth

I have been in DevOps related jobs for past 6 years dealing mainly with Kubernetes in AWS and on-premise as well. I spent quite a lot …

comments powered by Disqus