Does anybody have experience doing this? Is the coding example in the page above still valid? The page seems to have been updated 3 months ago but the fact that it leads to a non-existing request does not inspire a lot of confidence in me…
This link shows how you can update / persist your environment variables, if you see the code, in the body’s raw you update the Environment name and values:
I am not sure if the same will work Global variables, if you want to update the global variable, just use the ‘pm.globals.set’ method with the same global variable name, and it will update the variable.
For this link, seems like the request ID has changed, this is the new link to the public workspace’s request: Update Environment
Hey! Thanks for the reply. We are indeed using pm.globals.set but that only sets the current value of the global variables, not the initial value (i.e. it is not persisted).
Will try the PUT request to the Postman API. I infer from your answer that you do not know if it will take ‘Globals’ as the environment name and effectively update the global variables, right?
The above request is used to update the Environment which you specify in the ‘url’ with the <environment_uid>.
Here: raw: JSON.stringify({ 'environment': { 'name': 'New Env Name',
If you set the environment name as ‘Globals’, it will update the environment with the name Globals, but the variables you set will be the environmnet variables and not global variables.
Ususally when you have Environment variables and you would like to update/persist them manually, you can use the above set of code, but for global variables I am not aware/sure if the same can be used to update and persist the global variables as they are seprate from environment variables.