Postman Tutorial Part 37 – Export & Import Global & Environment Variables in Postman As a JSON

So we have learnt two ways of sharing a Postman collection:-

  1. Sharing as a Link
  2. Sharing as a JSON file

But there is a problem in above ways of sharing collection. If your postman collection is using Environment variable or Global variables , those variables are not imported and shared with collection automatically. You need to individually export and import it separately which we are going to learn in this post.

We can download Environment variables and Global variables as a JSON file. Step by step it is explained below:-

Steps to download Environment variable as a JSON:-

Make sure you have created some environment variables.

  1. Click on “Manage Environment” icon:-

2. It will list all available environment created by you.

3. Click on Download icon.

4. It will ask for the location to save it. Note the extension. It is a JSON file.

5. Open downloaded json file in any JSON viewer. You will see how variables are stored in a JSON array of JSON Objects.

Steps to import environment variable in Postman:-

There are two ways you can import environment variables:-

First way:-

  1. Click on “Manage Environment” icon and select “Import” control.

2. Now select the download json file of environment variables.

3. You will see a message stating “Environment <Name of environment> imported“. You will also see imported environment in Manage Environment window.

Note:- I have deleted existing “Auth Data” environment after downloading to show import result.

Second Way:-

  1. Click on “Import” control from toolbar.

2. Choose or drag downloaded JSON file of environment under “Import File” tab.

3. You will see a message stating “Environment <Name of environment> imported“. You will also see imported environment in Manage Environment window.

Steps to download Global variable as a JSON:-

The process of downloading Global variables as a JSON is similar to environment variables except one step.

  1. Click on “Manage Environment” icon:-

2. It will list all available environment created by you. Click on “Global” control. It will list all available Global variables.

3. Click on “Download as JSON” button. It will ask for the location for file to be downloaded.

4. Open downloaded json file in any JSON viewer. You will see how variables are stored in a JSON array of JSON Objects.

Steps to import global variable in Postman:-

The process of importing downloaded JSON file of global variables is exactly same as importing downloaded JSON file of environment variables. Only difference is the content of successful message.

Refer basics of API Testing here.

Refer detailed tutorial of Postman here.

More about API Testing in upcoming posts. Stay tuned.

If you have any doubt, feel free to comment below.
If you like my posts, please like, comment, share and subscribe.
#ThanksForReading
#HappyApiTesting

Author: Amod Mahajan

My name is Amod Mahajan and I am an IT employee with 6+ years of experience in Software testing and staying in Bengaluru. My area of interest is Automation testing. I started from basics and went through so many selenium tutorials. Thanks to Mukesh Otwani as his tutorials are easy and cover basics to advance. I have habit of exploring concepts by deep diving. I used to make notes. I thought of sharing my knowledge through posts and now I am here. #KeepLearning #ShareLearning

Leave a Reply

Please wait...

Subscribe to new posts to become automation expert

Want to be notified when my new post is published? Get my posts in your inbox.
%d bloggers like this: