So, i used Insomnia at the beginning of my carreer, but for the last couple months i’ve been trying Postman since it’s waaaaaaay better in any point.
I just have some newbie doubts about the general workflow of Variables. I have a couple collections and each of them use differents URLs, but, all of those have the {{base_url}} variable from the “Collection Variable”.
What is the right way to organize Variables? Using Collection Variables or creating envinronments for each one of them, like:
Exitlag Prod;
Exitlag Staging;
Api XPTO Prod;
Api XPTO Prod;
This way, wouldn’t i be able to call the wrong API if i don’t switch the envinronment on the top right corner of the screen?
I really don’t know the “ideal way” to manage the Variables.
Hi @navigation-special15 ,
Yes it is a possibility that you might enter some other environment variable to hit prod, staging, etc. The better approach will be to follow an order, for example whatever is declared at the top of hierarchy will be followed by postman. You can go with staging then prod or whatever sequence you would like to avoid any accidental calls.
For what you are trying to do I would recommend going the environment variables route, as collection variables will not change with the environment.
My general approach is anything environment specific needs to go in an environment variable, anything that remains the same regardless of environment can become a collection variable.
For transient variables I either use pm.variables if I don’t need them persisted and if I need the variable in another request then i make it a global variable as they are easy clear out as part of a new test using pm.globals.clear()
I’m not saying its perfect, but it works for me
Hope that helps.