Automatically update shared environment

Hy postman community.

First thank for your very good app. But something is not good at all.

I want to share environment with mates and i can’t find a way to automatically update my modification to existing environment.

I know, I know, you will answer with this link : http://blog.getpostman.com/2016/03/10/environment-sharing/

Well, i know how environment works but my question is : is there a way to automatically update shared environment ?

thanks a lot for reading and more for your answers. <3

1 Like

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.

https://docs.api.getpostman.com/

// 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 

:smiley:

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.

Hi @Julien_Gagneux

We’ve made some changes to shared environments with Postman 6.0. Any environment added to a team workspace is available to everyone in the workspace.

Updates made to shared environments are shared and are synced with everyone.

Hope this helps.

Thanks.