Postman set environment variable

Last modified 1 year ago
Danger icon
The last modifications of this post were around 1 year ago, some information may be outdated!

Summary

Postman has environment variables, convenient for things like JWT keys. This script takes response data and saves the JWT value.

Code

var jsonData = JSON.parse(responseBody);
postman.setEnvironmentVariable('token', jsonData.data.JWT);