How to specify environment URL when running collections

I can run collections using URL by doing this:

newman run https://api.postman.com/collections/myCollectionId?apikey=PMAK-myPostmanApiKey

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 https://api.postman.com/environments/myCollectionId?apikey=PMAK-myPostmanApiKey

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 https://api.postman.com/ and https://api.getpostman.com/ works too

newman run https://api.postman.com/collections/${api_collection_id}?apikey=${pm_key} -e https://api.getpostman.com/environments/${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.