What are Local Scope Variables in Postman?

PostmanREST APISOAP API

The local variables in Postman are also known as the Environment variable. The scope of the local variable is confined to the Environment in which it is created.

The steps to create a local variable are listed below −

Step1 − Click on the New menu, then click on Environment.

Step2 − MANAGE ENVIRONMENTS pop-up gets launched. We will enter the Environment name as ENV1. Then we will add a variable u and its value as https://jsonplaceholder.typicode.com/users. Next, close the pop-up.

Step3 − The new Environment (ENV1) will be available as one of the items in the No Environment dropdown.

Step4 − Select the ENV1 environment and enter {{u}} in the address bar. For using an Environment variable, we have to enclose it with double curly braces {{<Environment variable>}}. Then click on Send.

Step5 − Create another Environment - Environment_Test and make an attempt to access the same variable u that we have added to the Environment ENV1 in the Step2. In doing this, we shall encounter errors. This shows that the Environment variable only has local scope.

raja
Published on 25-Jun-2021 14:38:24
Advertisements