Newman help specifies that collection, environment and globals can be passed as a path or as a URL. I can see how to get a collection URL from Postman (by going to Share > Collection Link).
How can I get the URLs to Environment and Globals in Postman, so I could pass them to newman?
Asked
Active
Viewed 5,260 times
6

YuriK
- 207
- 2
- 4
-
Welcome to Stack Overflow. What have you already tried yourself to do this? Please review [How much research effort is expected?](https://meta.stackoverflow.com/questions/261592/how-much-research-effort-is-expected-of-stack-overflow-users). Stack Overflow is not a coding service. You are expected to research your issue and make a good attempt to write the code yourself before posting. If you get stuck on something specific, come back and include a [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve) and a summary of what you tried, so we can help. – S4NDM4N Sep 28 '17 at 04:36
-
how come you didn't find something to try from newman help ? – A.Joly Sep 28 '17 at 12:45
5 Answers
11
Using Newman with the Postman Pro API:
- Generate an API key
- Fetch a list of your collections from:
https://api.getpostman.com/collections?apikey=$apiKey
- Get the collection link via its UID:
https://api.getpostman.com/collections/$uid?apikey=$apiKey
- Obtain the environment URI from:
https://api.getpostman.com/environments?apikey=$apiKey
- Using the collection and environment URIs acquired in steps 3 and 4, run the collection as follows:
newman run "https://api.getpostman.com/collections/$uid?apikey=$apiKey" \ --environment "https://api.getpostman.com/environments/$uid?apikey=$apiKey"

Das_Geek
- 2,775
- 7
- 20
- 26

testmonger
- 121
- 1
- 7
2
Using the Postman desktop app please try the following steps -
- View your collection in Postman
- From the collection details view
(press the arrow next to the collection name) and select
View in Web
. - In the Postman web view, next to the Postman logo on the right, there is a drop-down.
- From the drop-down select the Workspace where your test collection is in.
- On the Collection list page, you will see Environments as a tab next to Collections.
- Select the Environments tab, then select the specific environment you want.
- The URL on this page is the Environment's URL you can use for Postman.

Peter
- 4,493
- 6
- 41
- 64
0
via Postman, I exported my environment as a json file, and then hosted that file on a webserver.

timB33
- 1,977
- 16
- 33
0
I didn't get that how to get Postman Globals URLs for passing to Newman? I am only able to get the collection and Environment URL.

Swapnil Sonawane
- 5
- 2
-3
From the command line, use the newman command line options:
-e <source>, --environment <source>
Specify an environment file path or URL. Environments provide a set
of variables that one can use within collections. Read More
-g <source>, --globals <source>
Specify file path or URL for global variables. Global variables are
similar to environment variables but has a lower precedence and can
be overridden by environment variables having same name.
If you use newman as a Node JS module, provide environment and global as options to newman.run():
newman.run({environment: <source>, globals: <source>}, callback)

Megan D
- 379
- 3
- 13
-
3This is all good once you've got the URL for the environment or globals. The actual question was where to get these URLs from! I'll explain: In Postman Pro you can share a collection and in Collection Link there is a URL that can be passed to newman. There is no Environment Link or Globals Link(or even share) option. So how can I obtain the URL of Environment and Globals in Postman Pro? – YuriK Oct 01 '17 at 23:55