How to specify environment URL when running collections

I can run collections using URL by doing this:

newman run

I just need to get the collection ID and my Postman Api key

but how can i use my env named Dev without exporting it to JSON?

newman run collectionURL -e

You can’t as far as I’m aware. If you want to include an environment, you need to use the appropriate command line switch.

The Cloud Hosted Postman CLI will allow you to read your environment without exporting it, but the job will run from the Postman Cloud.

You could potentially call the Postman API to get the environment details as part of your pipeline.

Manage Your Postman Environments with the Postman API | Postman Blog

1 Like

Thanks @michaelderekjones

actually it works, i somehow mistyped a key in my environment id yesterday.

both and works too

newman run${api_collection_id}?apikey=${pm_key} -e${api_dev_environment_id}?apikey=${pm_key} --verbose -r cli,json --reporter-cli-show-timestamps
1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.