postmanpostman-collection

How can I use Postman Collection Variables?


When I add environment variables I can use them in my post body with {{varName}}. But this does not work for collection variables (Collection > edit > Variables tab)

Postman collection variables

With the settings as shown above, if I add {{firstName}} to my body it does not work. How can I access these collection variables in my posts?

Currently if I try to post postman will just hang for a while then give this error

Error: Script execution timed out.↵    at 
ContextifyScript.Script.runInContext (vm.js:53:29)

If I use an environment variable or just type in a value it works fine.


Solution

  • It turns out {{varName}} does work. The problem was in my pre-request script. The API I was connecting to requires a checksum on the body so it pre-processes the variables in the body, but it was not setup to handle collection variables. This was causing postman to fail. User error.