Global Scope Variables in Postman?

PostmanREST APISOAP API

The Global variables are the ones which can be used in every Environments and can be utilized for executing every request. Click on the eye icon available to the top right corner of the Postman application. In the below image, the Global variable g with value value1 is populated under the Globals section.

Let us select another Environment – Environment_Test from the No Environment dropdown. Then again click on the eye icon. The Global variable g with value value1 should also be available for this Environment.

Now, enter {{g}} in the address bar (with the Environment pointing to Environment_Test) and hover mouse on it. It shall display G along with the SCOPE as Global.

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

Let us now select No Environment and enter {{g}} in the address bar. Hover mouse on it. It shall again display G along with the SCOPE as Global.

So the Global variable g is available for all Environments and requests. In Postman, if we have the same variable name defined for the Global and Environment (Local) variable, then the local variable is given the priority and the Global variable shall be stroked through.

The Global variable g having value value1 has been stroked through since another variable with the same name (g) has been defined as an Environment variable.

raja
Published on 25-Jun-2021 16:17:27
Advertisements