Postman Features You Should Be Using
June 17, 2022
Collections
This one is basic, but I’ve seen many people not use collections and spend unnecessary time looking through the History tab for past requests. Simply create a collection to group your postman requests (ex: collection per project) and use folders to separate requests in a collection further (ex: services in a project).
Variables
Variables let you reference values to use in your requests. For example, you could store a user id and reference that in multiple calls that perform operations on behalf of the user. Now when you want to operate on a different user, you simply change the user id. There are many types of variables.
Environments
These are variables that allow you to switch the context of your requests. This is useful for things like an api url that changes between dev, qa and prod environments. You can define the api url in an environment and simply choose the environment to hit.
Path and Query Parameters
By clicking “Params”, you can insert path and query parameters. This is better than having the parameters hardcoded in the path and query string since its easier to update the relevant variables as opposed to searching through the request url and updating that.
Pre and Post-Request Scripts
Pre and post-request scripts allow you to execute javascript code before and after requests, respectively. This allows you to do things like generate tokens before an api call, store the result of an api call into a variable and such.
Importing/Exporting cURLs
cURL is a common way to pass around api calls. Postman makes it simple to import and export cURL commands.
To Import:
- Click Import -> choose cURL -> select curl file.
To Export:
- Click Code -> choose cURL -> copy curl command.
Request Examples
Postman lets you save examples of your requests and their responses. This is great when you need to see the structure of an api response for different scenarios without having to call the api.