Using Environment in Postman is one of the best things that we can use during the testing and while playing around with API. Postman makes this development phase much easier.

API is getting more to the token-centric authentication and Environment Variable becomes handy.

I will use Cisco Sandbox for my examples, that is one of the great ways to get some practice with Cisco products API.

Setting up Postman Environment Variables:

Using them in API requests with {{variable name}} :

Sometimes the service itself generates Access Token and provides in the body or header. I used to just copy it from the header into all other requests.

But there is a better way to do it. Using Tests in the Token Generation request we can set the Variable from the body/header and it will be set as a normal Environment Variables, no more copy-paste.

The response with the Token and Domain looks like this:

In the following example we set the fmc_access_token environment variable from header “X-auth-access-token” and DOMAIN_UUID variable from header “DOMAIN_UUID” using Tests:

And now we have those variables as CURRENT VALUE in our environment ready to use in other requests:

It’s very useful when you have a collection of different requests set up with variables.