newman icon indicating copy to clipboard operation
newman copied to clipboard

Globals vairables URL

Open eloyucu opened this issue 6 years ago • 16 comments

Hi everyone.

I am sorry to make this low level question, but I didn´t find the solution by myself. Where to find the url for global variables in a workspace??

Thanks.

eloyucu avatar Sep 24 '18 11:09 eloyucu

@eloyucu Sorry if I misunderstood your question, did you mean the Docs link for globals? If yes then here: https://www.getpostman.com/docs/v6/postman/environments_and_globals/manage_globals

Or if you've some other issue in using the globals, can you elaborate more? Possibly record a video / GIF and share your OS details & your Postman App version.

sivcan avatar Sep 24 '18 11:09 sivcan

Hi @sivcan

No I mean... I have a workspace with its own set of global variables, to use them on newman I have to save them as a json file, and everytime I want to change something on those variables I need to download again, overwrite the old json file, commit and push.

On this repo I have seen this:

-g , --globals Specify the file path or URL for global variables. Global variables are similar to environment variables but have a lower precedence and can be overridden by environment variables having the same name.

So I want to use the url instead the path for the json file. Or... does the URL means that you have to host the globals json file and use your own URL??

Thanks.

eloyucu avatar Sep 24 '18 12:09 eloyucu

@eloyucu Using URL you can fetch collection/environment from Postman API or from an external source where your data is hosted.

Check Using Newman with the Postman API section in README.

However, Global environment can't be fetched via API yet. For now, you should either fetch the variables using the environment variables and use the API endpoint to avoid modifying the exported file everytime or, Use the --global-var option to pass a global variable.

codenirvana avatar Sep 24 '18 12:09 codenirvana

Hi @codenirvana. I prefer continue using the --globals flag to pass it the path to the json file with all the globals vars.

But it could be great can use a postman´s url for globals of a workspace that allows the auto synchronization, instead use the static json file.

Thanks.

eloyucu avatar Sep 24 '18 13:09 eloyucu

@eloyucu I completely agree with your point but, global variables can't be fetched via API yet.

Marking this as a feature request. Will update you once its ready.

codenirvana avatar Sep 25 '18 11:09 codenirvana

If this is still not ready, it would be immensely useful to me to have it implemented.

tyrantrook avatar Jul 31 '19 00:07 tyrantrook

@eloyucu Using URL you can fetch collection/environment from Postman API or from an external source where your data is hosted.

Check Using Newman with the Postman API section in README.

However, Global environment can't be fetched via API yet. For now, you should either fetch the variables using the environment variables and use the API endpoint to avoid modifying the exported file everytime or, Use the --global-var option to pass a global variable.

Is it possible to pass in global variables in the newman.run(option) object

Christian-Marc avatar Nov 21 '19 16:11 Christian-Marc

Sorry, but I'm trying to at global variables via the newman command-line:

newman.run({})

but they are not picked-up during running. Where can I find more instructions to use this construction? Do I need to add something inside the collection?

Christian-Marc avatar Nov 21 '19 21:11 Christian-Marc

I have defined request URL as a global variable but while execution it seems that Newman did not detect the same. Any solution guys?

abhilash-id123 avatar Jul 24 '20 08:07 abhilash-id123

I would like to use a global IIFE javascript class across multiple collections in a workspace. The common logic makes most sense to put into global variables in the workspace which can then be used via let commonScripts = eval(pm.globals.get('scriptname')); This works fine when I use Runner, but does not when i use the newman npm package. When I use the npm package to run newman I pass in the collection url and the environment url to run some of my tests, but without the globals I would have to add this to every single environment. This is not feasible due to the number of collections and how often they would need to be updated. I would be extremely greatful as well as other people who use postman if there were a globals url in the api.

michaelvannevel avatar Aug 21 '20 13:08 michaelvannevel

Any progress on this? I've run into the same issue where I'd really like to reference the global variables via url.

molteninjabob avatar Oct 08 '20 21:10 molteninjabob

Any progress on this? I've run into the same issue where I'd really like to reference the global variables via url.

XeniyaShirinova avatar May 31 '21 16:05 XeniyaShirinova

Finally I added a json file with my global config to the server, and then I run newman using the flag --globals and passing the path to the json file.

Sorry, I didn't find any other way to do this.

eloyucu avatar Jun 23 '21 12:06 eloyucu

Any progress on this? I've run into the same issue where I'd really like to reference the global variables via URL. We want to implement the global variable via URL thing because it keeps up synchronizing with the collection.

ashish-infogain avatar Dec 06 '21 11:12 ashish-infogain

Same here, this would really be beneficial for me.

gunesmes avatar Jan 05 '22 14:01 gunesmes

While collections and environments are live, you manually have to download and pass global variables json file which is a pain. This would be a super useful feature to have.

deepakaggarwal7 avatar Mar 29 '22 13:03 deepakaggarwal7

+1 please

anhhanuman avatar May 02 '23 07:05 anhhanuman