How to Create a Postman Environment Variable

How to Create a Postman Environment Variable

In this article, I will be showing you how to create environment variables and collections in Postman thereby making your API requests easy.

What is Postman? Postman is a popular API client that makes it easy for developers to create, share, test, and document APIs. This is done by allowing users to create and save simple and complex HTTP/s requests, as well as read their responses. The result - more efficient and less tedious work.

Some Benefits of Postman include:

  • User-friendliness. Postman provides code snippets, which support script creation with examples of validations for response time, response code, etc.

  • Accessibility. Postman users can access their files seamlessly by logging into their account on a device with the Postman application installed or the Postman browser extension.

  • Request tracking capabilities. For HTTP Response in Postman, it supports several status codes for users to verify the response. They are Successful requests, Empty responses, Bad requests, and Unauthorized access, to mention but a few.

  • Postman Environment is used to save values you frequently use in an environment such as API base URL, date variable, etc.

Steps to create a Postman Environment:

Click New button

environment.PNG

environment1.PNG

Create an Environment variable and assign values and save. e.g we will create a URL variable for localhost:3400

createenvironment.PNG

Change the environment name to any Name of your Choice e.g DEV-SERVER

environment2.PNG

Making API request with environment variables

click new request and type in your environment variable in double curly braces

postman.PNG

FINALLY... You can now make similar API requests using the environment variable.