Environments
Xplorer supports environment JSON files (Postman format) for managing variables across different configurations.
Loading Environments
Three ways to load:
- File → Open and select an environment JSON file
- Drag and drop the environment file into the window
- Use the Recent files menu
When loaded, the environment appears in the Environment Pane (right panel).
Active Environment
Important: Only one environment can be active at a time.
- The active environment is available to all loaded collections
- Environment name displays at the top of the Environment Pane
- All variables are visible and editable
Environment Variables
The Environment Pane shows all variables:
Structure:
- Variable name (left column)
- Current value (right column)
During execution:
- Variables update in real-time
- Changes persist for the session
- Updated values shown after collection runs
Using Variables in Requests
Reference environment variables using Postman syntax:
In URLs:
https://{{base_url}}/api/users
In headers:
Authorization: Bearer {{auth_token}}
In request bodies:
{
"userId": "{{user_id}}",
"environment": "{{env_name}}"
}
In scripts:
pm.environment.get("base_url")
pm.environment.set("auth_token", response.token)
Collection Variables
Collection variables are defined at the root collection level.
To view/edit:
- Select the root collection in navigation tree
- Click the Variables tab
Collection variables work the same as environment variables but are specific to that collection.
Priority:
- Environment variables override collection variables
- Local variables (in scripts) override both
Variable Scope
Variable resolution follows this priority (highest to lowest):
- Local variables (defined in scripts)
- Environment variables
- Collection variables
- Global variables (if supported)
Creating Environment Files
Environment files are standard Postman JSON format:
{
"name": "Production",
"values": [
{
"key": "base_url",
"value": "https://api.example.com",
"enabled": true
},
{
"key": "api_key",
"value": "your-api-key",
"enabled": true
}
]
}
Switching Environments
To switch to a different environment:
- Open the new environment file (File → Open or drag and drop)
- The new environment becomes active immediately
- Previous environment is replaced
Tip: Keep multiple environment files for different configurations (dev, staging, production).
Modifying Variables
Variables can be modified:
Via Environment Pane:
- Edit values directly in the pane
- Changes apply immediately
Via Scripts:
pm.environment.set("auth_token", "new-token-value")
pm.environment.unset("old_variable")
Persistence
During session:
- Variable changes persist while the application is running
- Updated values remain until you close the app
Between sessions:
- To save changes, you would need to update the environment JSON file
- Consider exporting or manually updating your environment files