Hi Folks,
Hope you all are doing great…
I have a situation where i need to capture the response from previous request and save it to an environment variable and append it with some fixed json code and then use it as a request payload - body in the next request.
Request 1 - I am capturing the response and saving it to an environment variable
var jsonResponse = pm.response.json(); var getJsonResponse = JSON.stringify(jsonData);
pm.environment.set(“details”, getJsonResponse);
Below is the response captured and assigned to the above variable:
{
“programNumber”: “xxxxxxxxxxxxx”,
“wpType”: “xxx”,
“referralType”: “xxxxxxxxx”,
“status”: “xxx”,
“openDate”: “2017-04-27”,
“transitional”: false,
“benefitAmount”: 357.0,
“requirementsMet”: false,
“reopenInd”: false,
“userModel”: {
“offices”: ,
“roles”:
}
}
Now i want to append the below JSON part to the response saved to the environment variable and send it as a request body for next request
,
"$promise": {},
"$resolved": true,
"staffId": “xxxxxx-18cf-xxxx-b18d-xxxxxxxxxx”,
"transitionalDate": null