Sorry it has been a while but I recently moved job and house, so life has been hectic. Next we will discuss variables. There are a lot of different variables you can use like Collection, Environmental, path, and others. The main 2 I use are Environmental so that we can have different variables for Dev, QA, Prod and any other environments there maybe.
One thing I will go over later is reusable code. You can store code in an environmental variable.
Setup Environmental Variable
Create an Environmental Variable for the project with the base URL as a variable called url. This allows us to use {{url}}
in our calls so we can use the test one both containers.
url - example.com/api
Using Variable over other API calls
Another trick is using the environmental variable for passing variables from one API call to the next. For example we have an Encryption API.
pm.environment.set("encrypted", pm.response.text()); //Sets the variable and allows us to call it later.
//In the other API we can now use the below as a variable.
{{encrypted}}
Path Variables
One thing you can do when setting up Parameters is store the value in the environmental variable. You can also do this with Path Variables. For example you can call example.com/:variable. :variable is a path variable and as such you can set it to be an environmental variable or anything else. You are now allowed to change it just like you would a parameter.
Links
Postman Quick Reference Guide Chai Assertion Library Regex Cheat Sheet Postman: The Complete Guide on Udemy