How to create a Global Variable in Postman?


We can create a Global variable in Postman. A Global variable can be utilized in all the Environments and can be applied to all requests. In Postman, if we have the same variable name for the Global and Environment variable, then the preference is given to the Environment variable.

To create a Global variable follow the steps listed below −

Step1 − Click on the eye symbol appearing right of the No Environment dropdown. Then click on Edit in the Globals section.

Step2 − The MANAGE ENVIRONMENTS window comes up. Here, we have added the variable url and set the value as https://www.tutorialspoint.com/index.htm. Click on Save and close the window.

Step3 − Choose another Environment and verify if the Global variable url is available for use. Here, we have a couple of Environments - Environment_Test and Mock Server.

Step4 − Choose the Environment - Environment_Test and enter {{url} in the address bar. On pointing the mouse on it, it displays the letter G(meaning global) and the SCOPE as Global.

To add an Global variable in a request we have to enclose it with double curly braces {{<name of Global variable>}}.

Step5 − Choose the Environment - No Environment and enter {{url} in the address bar. On pointing the mouse on it, it again displays the letter G(meaning global) and the SCOPE as Global.

So, a Global variable can be accessed from all Environments.

Updated on: 25-Jun-2021

803 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements