Environments for Postman Collections allow you to create global and local variables in the Collections, and to store the values that replace the variables.

This document uses the GoToWebinar Collection as an example - the GoToWebinar Collection has several variables stubbed in.

Overview

Postman calls are broken into the basic components of an API call: action (GET, POST, PUT, DELETE, etc.), URL, parameters, headers, body. When you send a call the components are combined into a single call. Any content of that call may be inserted automatically at call time using a Postman variable.

As shown below, text in different sections of the call interface can be replaced with a variable. Variables are identified by double curly braces. Those variables currently defined in the active environment (red circle in upper right of image below) - like {{baseURL}} and {{tomorrowTime}} in the image - are displayed in orange; those that are not defined in the environment - see {{accountKey}} in the image - are shown in red.

When you send the call, the variable in the call is automatically replaced with the content defined in the environment.. 

You can click the 'Eye' icon next to the Environments drop-down to create, update, or delete environments and the variables defined in them. 

In the GoToWebinar Postman Collection, we have created several variables in the calls. 

Creating a Postman Environment

A good first step is to create a Postman Environment.

  1. In the Environments area of the Postman interface, select the Manage Environments icon (Gear).
  2. Click Add to add an environment.
  3. Enter an environment name and choose Add.

You can begin adding varibles during the create process, or do that later.

Adding Postman Variables

  1. Identify the variable you want to create - a standard GoTo product variable (e.g., webinarKey, accountKey, fromDate, etc.), or any data element that is passed (e.g., baseURL, historyStart, etc.).
  2. In the Postman interface, locate the source of the variable. It may be in the URL, in the Parameters, or Headers, and replace the variable with {{varName}}.  For example, in the Collection, we replaced https://api.getgo.com/g2w/rest/v2 with {{baseURL}}.
  3.  
  4. In the area, either selesc the gear icon (Manage Environments) and choose Add. Or, if you already have an environment created, open it.

 

Note about Initial vs Current Values

The Initial value is stored across the system. If no Current value exists, the Initial Value is used. The current value is the value sent with the call.