Using Environment Variables in POST Payload

Can I use the environment variables set in the previous test in the payload I am posting?

eg.

POST /list

{
    "some_key": environment.saved_value
}

      

+3


source to share


1 answer


Yes, you can do it. You send it this way

{ 
    "some_key" : "{{environment_variable_name}}"
}

      

So, if in the previous test you installed it with something like

postman.setEnvironmentVariable("id","some_value")

      



You can use it in your POST with

{ 
"some_key" : "{{id}}" 
}

      

Hope this answers your question.

+6


source







All Articles