# Trying to get a session value from a POST call

**URL:** <https://community.postman.com/t/trying-to-get-a-session-value-from-a-post-call/6804>\
**Category:** Help Hub\
**Created:** [July 26, 2019, 5:42pm UTC](https://community.postman.com/t/trying-to-get-a-session-value-from-a-post-call/6804 "2019-07-26T17:42:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jimis.drpc](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@jimis.drpc](https://community.postman.com/u/jimis.drpc)\
**Post date:** [July 26, 2019, 5:42pm UTC](https://community.postman.com/t/trying-to-get-a-session-value-from-a-post-call/6804/1 "2019-07-26T17:42:57Z")

</div>

I am getting the following error `TypeError: postman.getResponseHeader is not a function` while trying to retrieve a session key from this value returned in a post response:

```auto
Location →http://partners.api.skyscanner.net/apiservices/pricing/uk2/v1.0/b5b906e9-164e-4f1d-b5ce-9085b8a3506d

```

Are `postman.getResponseHeader` and `JSON.parse` functions available in Pre-request script in most recent Postman version?

I created this question originally in [https://stackoverflow.com/questions/57212234/trying-to-get-a-session-value-from-a-post-call-in-postman-typeerror-postman-ge](https://stackoverflow.com/questions/57212234/trying-to-get-a-session-value-from-a-post-call-in-postman-typeerror-postman-ge)

Kindly, do you see any strange thing in the uploaded screen shot below? I saw in several blogs people using the function I am trying to use. Am I using in wrong place or should I add some extra dependency to postman? I guess not.

 ![postman%202nd](https://us1.discourse-cdn.com/getpostman/original/3X/3/3/33779b6c1f96a3e20fd755c00f21f0c6ef5d3690.png) ![postman](https://us1.discourse-cdn.com/getpostman/original/3X/b/d/bdd8713beda37ef4e4134407a3c311fa67524fad.png)

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [July 26, 2019, 6:19pm UTC](https://community.postman.com/t/trying-to-get-a-session-value-from-a-post-call/6804/2 "2019-07-26T18:19:22Z")

</div>

Hey @jimis.drpc,

Thanks for your question 🏆

That is the older syntax and you can find the new `pm.*` API way of getting those `Response Headers` here:

[https://learning.getpostman.com/docs/postman/scripts/postman\_sandbox\_api\_reference#pmresponse](https://learning.getpostman.com/docs/postman/scripts/postman_sandbox_api_reference#pmresponse)

As it’s the `Response Headers` that you’re trying to access, those would be available `after` the request has been made, not `before`.

You would need to move that part of your script over to the `Tests` tab. It looks like the same solution was given over on Stackoverflow.

Hope that helps.

---

<div class="post-metadata">

**Author:** ![jimis.drpc](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@jimis.drpc](https://community.postman.com/u/jimis.drpc)\
**Post date:** [July 26, 2019, 8:03pm UTC](https://community.postman.com/t/trying-to-get-a-session-value-from-a-post-call/6804/3 "2019-07-26T20:03:53Z")

</div>

Thanks, now it is working.
