how to pass data between requests in api

The solution for “how to pass data between requests in api” can be found here. The following code will assist you in solving the problem.

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

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

inline scripts encapsulated in