# POST then verifying with a GET

**URL:** <https://community.postman.com/t/post-then-verifying-with-a-get/3793>\
**Category:** Help Hub\
**Created:** [January 10, 2019, 10:25pm UTC](https://community.postman.com/t/post-then-verifying-with-a-get/3793 "2019-01-10T22:25:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dleenhouts](https://avatars.discourse-cdn.com/v4/letter/d/898d66/32.png) [@dleenhouts](https://community.postman.com/u/dleenhouts)\
**Post date:** [January 10, 2019, 10:25pm UTC](https://community.postman.com/t/post-then-verifying-with-a-get/3793/1 "2019-01-10T22:25:18Z")

</div>

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/](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

---

<div class="post-metadata">

**Author:** ![mick-mcbride](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/mick-mcbride/32/783_2.png) [@mick-mcbride](https://community.postman.com/u/mick-mcbride)\
**Post date:** [January 10, 2019, 10:46pm UTC](https://community.postman.com/t/post-then-verifying-with-a-get/3793/2 "2019-01-10T22:46:13Z")

</div>

@dleenhouts

Are you running the POST in the pre-request script and then the GET? If you’re doing a POST and then a GET the “var jsonData = JSON.parse(responseBody); postman.setGlobalVariable(“id”, jsonData.id);” in the Tests.

Mick

---

<div class="post-metadata">

**Author:** ![dleenhouts](https://avatars.discourse-cdn.com/v4/letter/d/898d66/32.png) [@dleenhouts](https://community.postman.com/u/dleenhouts)\
**Post date:** [January 10, 2019, 10:53pm UTC](https://community.postman.com/t/post-then-verifying-with-a-get/3793/3 "2019-01-10T22:53:27Z")

</div>

They’re separate requests. The POST triggers a bunch of services, & I want to run a subsequent GET to verify that those services did what they were supposed to do. And there’s nothing in the response of the POST that I can use to verify that, which is why I want to do a separate GET request that uses the ID returned in the POST response body.
