reuse json body value in another request as input?

Viewed 213

Have dynamic generated post request for student pass every time send post method and want to use this dynamic_value in another request as an input. How to use this ?

{ "study pass":"dynamic_value"}

Used below but not storing that dynamic value in variable.

var Json=JSON.parse(responsebody); postman.setEnviormentVariable("study pass",jsonData.study_pass);

output (dynamic_value) from Request 1 > need to be used as input for Request 2

1 Answers

Depending on where you want to use the environment variable study pass, you can use:

  • {{study pass}} in the URL, request body, request headers. form data
  • pm.environment.get('study pass') in the pre-request script or test

But you're setting a variable Json, but when calling setEnvironmentVariable, your using jsonData. With consistent naming, your problem should be fixed.

Related