Skip to content

TypeScript code snippet – How to pass data between requests in postman?

To pass data between requests in postman

I would use Enviroment or Global Variable
Lets say I want to pass my token between
requests. Than I would create empty global
variable and save the entire token response
as json and print the accessToken from 
response and set the value of global variable
to json field by writing like for example:

var responseJson = pm.response.json(); 
console.log( responseJson.accessToken  );
pm.globals.set("my_secret_token",  responseJson.accessToken );

See also  Python code snippet - How to get rid of all null values in array ?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.