Whats the best way to edit variables

Hello, I’ve created a collection that would use a single variable in several different requests, currently I’m storing this variable in a custom environment (variable is an email in case it matters), anyway I’m wondering if there is a better way to store and edit the variable or this is the most optimal one?

Hey @theToncheff,

If the value of the variable is meant to stay the same regardless of the environment you’ve selected you may want to use Global Variables to store its value:
https://learning.getpostman.com/docs/postman/environments-and-globals/manage-globals/

Though if you need that variable only when using a specific environment then the Environment variables are the way to go!

I’m currently using environment to store the variables as they would be specific to certain collections, although I might want to eventually use around 15 variables that would be called through the body - raw json. It seems like too much work but also the most convenient way?

side question, would it be possible to use the raw json for format data in body, that would probably make it easier to edit the information for the post request?

If your variables are tight to your collection, it makes sense to use Collection variables.

I consider it a bad practice to use globals => read here why: https://link.medium.com/EbG8Spzuo1
Using environment variables if you don’t have multiple environments, does not make so much sense.


Regarding your side question (which is always great to ask separately so that others can find it as well): if you want to have more control over the body, I would suggest the approach I have described in this video: https://www.youtube.com/watch?v=hSX7Dcjy000

In a nutshell, you create your request body in the pre-request, something like this:

2 Likes