A Good Start with Postman

Wassa Team
Wassa
Published in
4 min readOct 16, 2018

The Ultimate Guide for First Time Users

A Good Start with Postman : The Ultimate Guide for First Time Users

Introduction

Testing a backend API is one of the most important part of its creation. Postman let you create all the urls you need and test behavior of each one. But it can be very time consuming. Let’s see some useful tips to save time (and money).

Default Use of Postman

On the first launch, you arrives on a screen like this (depending of your version) :

Then, to run request, you only need to set his type (GET, POST, etc.) (1), his URL (2), his potential headers and parameters (3) and run it (4).

It is how Postman works, and it does it efficiently. But we easily understand why it can be time consuming. For each request, you have to enter URL, headers and parameters.

Environments & Variables

For instance, setting the domain name for each new request can be boring really quickly. What if we had a tool to spare that ? You know what ? We have ! We call that Environnement and Variables. Click upper-right corner allow you to access this feature :

Instead of putting domain name directly into url, you can specify it in environment variables :

Select your newly created environment in the dropdown to make all environment variables accessible for Postman from now. You can switch between environment as you want (for instance, switch between dev and prod environment).

Then, you only need to use variable (here : {{domainName}}) in URL field, and Postman do the rest. Every time you run the request, Postman will replace this variable by the content you set.

It becomes very handy when, for instance, you have to use an API and it requires to login (mostly to retrieve a token), and then you should use this token on each other request. Setting this token in environment variables make it public from everywhere in Workspace (see Workspace).

Workspace management

If you are on several projects at the same time, or if you are a clean up kind, it can be interesting to gather all request of a project at the same place. Postman allow you to do so in Collection’s view :

But it allows you to do so much better. Workspaces ! A Workspace is by definition a space for one work. Yes, it’s a project ! :) A Postman Workspace can be easily share between colleagues and has it own environment variables. To access them, you need to click on top of the screen on My Workspace (You have to sign in first). Then, you can set your Workspace a name (Localhost for instance), and specify if it is a public (Team)’ or private (Personal) one. Caution there, free version of Postman don’t allow you to share more than 25 request with your team.

Useful Script

A powerful tool allow you to load environment variable just after a request has been executed. Assuming you received a response like this one from a login call :

To automatically set token to environnement variable, just go to Tests tab of login request, and enter this code :

This code will parse the JSON response and set token environment variable right after login complete. The token will now be accessible for all other request of you Workspace by calling it {{token}}.

Last words

As you may have seen, Postman can be a very powerful tool. We hope these few tips will help you saving time with Postman, and allow you to concentrate on your real job, coding ! Stay tuned for new post about Postman in the future!

Do you want to know more about WASSA?

WASSA is an Innovative Digital Agency expert in Indoor Location and Computer Vision. Whether you are looking to help your customers to find their way in a building, enhance the user experience of your products, collect data about your customers or analyze the human traffic and behavior in a location, our Innovation Lab brings scientific expertise to design the most adapted solution to your goals.

Find us on:

· Facebook and Twitter

· LinkedIn

· GitHub

· Our WebSite

--

--

Wassa Team
Wassa
Editor for

Wassa is a company specialized in the design of innovative digital solutions with great added value.