Postman set environment variable

Last modified 12 months ago

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);