postman add variable code example
Example 1: postman environment variables in body
{ "customer_id" : "{{cust_id}}" }
Example 2: Postman Variables
just like variables in Java.
we can create variables in postman to reuse the value
1.Global variables: accessible everywhere in same workspace
2.Environment variables: accessible in selected environment
3.Collection Variables: belong to the collection itself and
only accessible within the collection
Example 3: collection variable api
Only accessible within the same collection and
can not be accessed anywhere else
COLLECTION variables are available throughout
the requests in a collection and are independent
of environments, so do not change based on the selected environment.
I use collection variables when
I use single environment like url details.
We can refer to the variable by using {{}}(double curly brace)
and it can be used anywhere