In the "Tests" tab, use the code below:
var jsonData = JSON.parse(responseBody);
postman.setEnvironmentVariable("myId", jsonData.id);
It will save the id field in the JSON response payload to the variable myId. The variable can be used in another request this way: {{myId}}
No comments:
Post a Comment