No - for now, environments need to be manually re-shared each time there’s an update. The reason for this is that running pre-request scripts/tests can modify environment variables, and sensitive information like tokens can accidentally leak to team members.
Okay, i understand why and it’s a good reason. But may i (by script for example) override this restriction if i want ?
I use Postaman to plan automatic tests at each deployment and i need an up to date environment for my collègues. When we develop our test ours environments changes a lot sometimes.
Although you can’t edit environments that are shared with your team through the UI, I believe you can edit the shared environment through the Postman Pro API.
// Hit the below GET request in Postman whilst passing in your Postman Pro API Key as a header.
https://api.getpostman.com/environments
//Grab the UID linked to the environment you want to edit.
// (Note: The shared environments have ".template" at the end)
// Then hit the below GET request passing your UID for the given environment you want to edit.
https://api.getpostman.com/environments/{{environment_uid}}
// Copy the entire JSON response returned from this response.
// Then hit the below PUT request, but pass in the entire JSON body from the previous endpoint in the Body as raw JSON.
// Feel free to change any of the values in 'values' array
https://api.getpostman.com/environments/{{environment_uid}}
//For example, say if you have your API Key parametised as an env variable and it's now changed.
// Just find the 'key' called "apiKey" or whatever you have named the env variable inside the 'values' array.
// Not just change the 'value' linked with that 'apiKey' 'key'
//Submit the request and boom. All the subscribers to that environment should have the new API Key
Obviously try this out with an example shared environment before you start changing things that are actually shared with your team.
Moderators - If this is confirmed as working I’ll be more than happy to post this in the Community Showcase section of the forum.