I'm looking for a way to make environment variables in Postman, that contain other variables. For example: {Server}=localhost;{Port}=9200;{ServerUrl}={Server}:{Port}.
Like in Make...
This way it doesn't seem to work with Postman.
EDIT:
My attempt:
To set up Postman environment variables: In the top right corner of Postman, click the environment selector and select Manage environments. Click Add to add a new environment where you'll define your OneLogin environment variables. Note: You'll need to use your API credentials to generate the access_token value.
You can access your environment variables from Postman and from your request elements, including the URL, parameters, body data, and test scripts. For the list of all your environments, select Environments in the sidebar.
The pm object provides functionality for testing your request and response data, with the postman object providing additional workflow control.
A dynamic variable name starts with '$. ' In the request URL section, a dynamic variable should be written in {{__}} format. Let's say you have to pass an integer number from 1 to 1000, so for that, you need to add {{$randomInt}}.
You could do it but I wouldn't recommend it, just seem like you're missing the benefit creating a set of variables and then changing the values of these by selecting a different environment file.
Add this string {{ElasticsearchProtocol}}://{{ElasticsearchServer}}:{{ElasticsearchPort}}
as the ElasiticsearchUrl
variable, on the environment file.
Or you could add this to the Pre-Request Script
:
let ElasticsearchProtocol = pm.environment.get('ElasticsearchProtocol')
let ElasticsearchServer = pm.environment.get('ElasticsearchServer')
let ElasticsearchPort = pm.environment.get('ElasticsearchPort')
pm.environment.set("ElasticsearchUrl", `${ElasticsearchProtocol}://${ElasticsearchServer}:${ElasticsearchPort}`)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With