I’ve got a POST that generates some values & successfully sends to an API. I want to run a subsequent GET using the “ID” value in the response body of the POST, but I haven’t had any luck with variables (environment or global, neither seem to work). The specific error I’m seeing is:
There was an error in evaluating the Pre-request Script: ReferenceError: responseBody is not defined
My pre-request script is:
var jsonData = JSON.parse(responseBody);
postman.setGlobalVariable(“id”, jsonData.id);
Not sure what I need to add to get this working, the above is taken right from a very old postman blog post (http://blog.getpostman.com/2014/01/27/extracting-data-from-responses-and-chaining-requests/).
Does anyone have any examples of this in general? POSTing then verifying with a GET?
Thanks