You Can Now Identify Unresolved Variables Easily
Variables are one of the essential building blocks of API development and testing in Postman. They foster reusability, configurability, and collaboration in a state-of-the-art API platform experience that supports advanced cases such as creating dynamic workflows and performing automated API testing.
When you are testing APIs with Postman, you often realize that the request failed or resulted in an unexpected response because your variables weren’t defined in any of the active scopes. We refer to such variables as unresolved.
We’ve now made it easier for you to identify your unresolved variables and take steps to resolve them. We hope this helps you in testing your API requests more efficiently so that you can be even more productive.
Why should you care about unresolved variables?
While Postman doesn’t block you from sending a request if your variable is unresolved, your API server expects a certain value for the variables; if that expectation is not met, your request could result in an unexpected response. Other times, your request might fail due to reasons such as incorrect URLs, missing headers, missing path parameters, and more.
Consider the following example:
In the below screenshot, you can see that Postman can’t find the variable {{base_url}} in any of the active scopes (read more about scopes here):
When you send such a request, the request would fail as shown below:
To get a successful response in the above example, you would need to create and assign a value to the variable in environment, collection, or global. If the variable is already present in some environment, you need to ensure that the given Postman environment is selected as an active environment.
Sometimes variables are also defined using the pre-request or test scripts. In such cases, Postman will pick up the value at runtime and your request will execute as expected.
An enhanced experience for unresolved variables
With this release, we are improving your experience with unresolved variables. You will now be able to easily identify the unresolved variables as shown below:
Hovering over the unresolved variable will provide you a button to quickly create the variable by clicking on Add new variable or check if it’s present in your global/active environment or collection as shown below:
We hope this helps you debug your unresolved variables and get an instant sense of the next steps to resolve them. Learn more about unresolved variables in Postman here and check out our blog post on best practices while working with variables.
What do you think about this feature? Tell us in a comment below. You can also give product feedback through our Community forum and GitHub repository.