6 Postman Tips

Environment variables, layout change, change history, … and more!

Postman is a great tool to test APIs without writing a single line of code. Here are some functionalities I find very useful:

1. Environment variables

To avoid copy-pasting the same token or key across multiple Postman requests, you can use variables.

First, click on the eye symbol, on the top right corner

This will open a new tab to create an environment. Name your environment (eg: NY Times) and add a variable (eg: api-key) with its initial value (123). Click Save.

Going back to the initial GET request, select your newly created environment in the environment dropdown (top-right corner).
You can now use the variables in the request by wrapping the variable name with 2 curly brackets {{api-key}}.

If you want to edit the variable, click on the eye symbol again, edit the current value, and press enter.

This can come in really handy when using a token that expires quickly. By using variables, you only need to update your new token in one place and all your requests will use the new token.

2. Generating client code

This very smart tool can generate the code for your API request in one click in many different languages (Curl, Node, Java, C#, PHP, Python…).

Click on the </> sign on the right corner

You can then choose in which language you’d like to generate your code snippet. Here is an example when selecting Nodejs Axios

3. View enhancement

In my opinion, the Postman default layout is crowded and hard to read. An easy way to improve that is to hide the sidebar (⌘ + \) and switch the two-panel views ( + ⌘ + V) to show the response beside the request (instead of below). If you are not using a Mac, open the View menu to find the shortcut commands

Here is a preview of how it looks like:

4. Share your postman collections

If you are using Postman at work and have a whole collection of requests set up, you might want to share it with colleagues. To do so, click on the 3 dots symbol then Export.

To import a Postman collection, click on File > Import and selected the postman collection file.

Note that this file won’t contain environment variable settings.

5. View your change history

6. Save your API response

Saving the response can be handy when you want to demo an API usage without having to worry about refreshing your token. When you got the API working, click on Save Response > Save as example. You can then refer back to it later, even if the token expired.

Wrapping up

I hope you learned something new about Postman. Please share your Postman tips in the comments! Thanks for reading :)

--

--

JavaScript Mid-Level Developer, I write blogs to learn and share what I learn.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Aude Faucheux

JavaScript Mid-Level Developer, I write blogs to learn and share what I learn.