Using Environments in Postman

I’m using Postman more lately and showing off the Environments feature really often. I really like this feature for giving easy ways to handle values I use frequently, but it seems to be a bit of a hidden gem, so I thought I’d write about when I find it useful, in case you do too!

Environments are essentially a collection of variables. Most of mine contain:
* API credentials, either a token or a username/password
* Base URLs so I can change which platform I’m targetting

The controls for Environments are in the top left, no down a little, that’s it! A dropdown, an eye, and a settings cog :)

You can set up different Environments for test/live platforms, for different geographical regions, or whatever you need. I use “Lorna Nexmo” for my live Nexmo credentials and API base URLs, and “Prism” for when I’m using prism as a local mock version of an API. Switching between the two becomes very quick and convenient, and I find it a real timesaver!

Once you have variables set up in an Environment, it makes it very easy to use them whenever you need them. This is great because I don’t have to keep looking up credentials every time I want to add them to a request. I can just type {{ and see what autocompletes!

start typing {{ and get a menu of entries to use

Such a simple feature but very handy. Also, see in the screenshot it previews the values? I can use the “Prism” Environment so that I don’t display my actual credentials when I’m streaming/speaking/blogging, and then just flip it in the Environments dropdown. Very useful!


Also published on Medium.

Leave a Reply

Please use [code] and [/code] around any source code you wish to share.

This site uses Akismet to reduce spam. Learn how your comment data is processed.