# Get session cookie in SendRequest item

**URL:** <https://forum.katalon.com/t/get-session-cookie-in-sendrequest-item/6593>\
**Category:** API Testing\
**Tags:** api-testing, katalon-studio\
**Created:** [September 14, 2017, 3:42am UTC](https://forum.katalon.com/t/get-session-cookie-in-sendrequest-item/6593 "2017-09-14T03:42:56Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eric\_Chuhao\_Chan](https://avatars.discourse-cdn.com/v4/letter/e/ac91a4/32.png) [@Eric\_Chuhao\_Chan](https://forum.katalon.com/u/Eric_Chuhao_Chan)\
**Post date:** [September 14, 2017, 3:42am UTC](https://forum.katalon.com/t/get-session-cookie-in-sendrequest-item/6593/1 "2017-09-14T03:42:56Z")

</div>

Hi guys,

I am trying to verify the response value of RESTful request. In creating the Web Service Request, I need to specify all HTTP header information, one of which is Cookie.

As far as I understand, Cookie is generated per login session, and cannot be pre-specified. However, it seems that Katalon Studio does not support getting browser cookie on the run.

So my question, is there a way to program into the script to retrieve Cookie information of the current login session?

Thanks

---

<div class="post-metadata">

**Author:** ![Andrej\_Podhajsky](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/andrej_podhajsky/32/1055_2.png) [@Andrej\_Podhajsky](https://forum.katalon.com/u/Andrej_Podhajsky)\
**Post date:** [July 24, 2018, 3:17am UTC](https://forum.katalon.com/t/get-session-cookie-in-sendrequest-item/6593/2 "2018-07-24T03:17:54Z")

</div>

Hello Eric  
cooke, if set is in response header something like this:

```auto
response = WS.sendRequest(reqObj)
println response.getHeaderFields()['Set-Cookie']

```

---

<div class="post-metadata">

**Author:** ![Raj4](https://avatars.discourse-cdn.com/v4/letter/r/b5a626/32.png) [@Raj4](https://forum.katalon.com/u/Raj4)\
**Post date:** [August 14, 2018, 8:06pm UTC](https://forum.katalon.com/t/get-session-cookie-in-sendrequest-item/6593/3 "2018-08-14T20:06:12Z")

</div>

Hi Team,  
I have a HTTPS RESTful webservce URI, one POST request shows Status : 200(for Login) with Jsessionid: 5382856D0F7ABB07F748B034BBB6603C  
and another POST RESTful webservce shows Status : 401 Unauthorized with Jsessionid: 8A3F7887C130C1447B3201201AF76554.  
Please let me know how can I handle this

---

<div class="post-metadata">

**Author:** ![Andrej\_Podhajsky](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/andrej_podhajsky/32/1055_2.png) [@Andrej\_Podhajsky](https://forum.katalon.com/u/Andrej_Podhajsky)\
**Post date:** [August 14, 2018, 8:24pm UTC](https://forum.katalon.com/t/get-session-cookie-in-sendrequest-item/6593/4 "2018-08-14T20:24:09Z")

</div>

Hello Raj,  
do you also recieve some token from login request?

---

<div class="post-metadata">

**Author:** ![Raj4](https://avatars.discourse-cdn.com/v4/letter/r/b5a626/32.png) [@Raj4](https://forum.katalon.com/u/Raj4)\
**Post date:** [August 15, 2018, 10:37am UTC](https://forum.katalon.com/t/get-session-cookie-in-sendrequest-item/6593/5 "2018-08-15T10:37:26Z")

</div>

Thanks Andrej, for your updates.

I can’t see any Token and for you information, Please find below response(s) for different POST URIs.  
**Note:** I have one more query that is my RESTful URL is not complete.  
Ex:

1. Given URL: [https://Domain/xxx/login](https://Domain/xxx/login), but it shows Path=/xxx/

2. Given https, but is shown HttpOnly().

3. For \*\*login(POST method) \*\*below is the **Response** I received, observed in **Header**

Transfer-Encoding: chunked

X-Frame-Options: SAMEORIGIN

HTTP/1.1 200 OK

Cache-Control: no-cache, no-store, max-age=0, must-revalidate

Server: Apache-Coyote/1.1

X-Content-Type-Options: nosniff

Set-Cookie: JSESSIONID=37732DB2684E2363F353875C0D08ACAE; Path=/xxx/; HttpOnly

Expires: 0

Pragma: no-cache

X-XSS-Protection: 1; mode=block

Date: Wed, 15 Aug 2018 10:19:16 GMT

Content-Type: text/plain

1. For next \*\*URI(POST method) \*\*below is the \*\*Response \*\*I received, observed in **Header**

Transfer-Encoding: chunked

X-Frame-Options: SAMEORIGIN

HTTP/1.1 401 Unauthorized

Cache-Control: no-cache, no-store, max-age=0, must-revalidate

Server: Apache-Coyote/1.1

X-Content-Type-Options: nosniff

Set-Cookie: JSESSIONID=D0CCB85578291083C11556720996B755; Path=/xxx/; HttpOnly

Expires: 0

Pragma: no-cache

X-XSS-Protection: 1; mode=block

Date: Wed, 15 Aug 2018 10:23:48 GMT

Content-Type: text/plain

---

<div class="post-metadata">

**Author:** ![Raj4](https://avatars.discourse-cdn.com/v4/letter/r/b5a626/32.png) [@Raj4](https://forum.katalon.com/u/Raj4)\
**Post date:** [August 17, 2018, 7:50am UTC](https://forum.katalon.com/t/get-session-cookie-in-sendrequest-item/6593/6 "2018-08-17T07:50:56Z")

</div>

Hi Team,  
Are there any updates on this?  
Thanks.

---

<div class="post-metadata">

**Author:** ![Andrej\_Podhajsky](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/andrej_podhajsky/32/1055_2.png) [@Andrej\_Podhajsky](https://forum.katalon.com/u/Andrej_Podhajsky)\
**Post date:** [August 17, 2018, 8:24am UTC](https://forum.katalon.com/t/get-session-cookie-in-sendrequest-item/6593/7 "2018-08-17T08:24:17Z")

</div>

just question, did you try to set cookie with JSESSIONID in 2nd call?

---

<div class="post-metadata">

**Author:** ![Raj4](https://avatars.discourse-cdn.com/v4/letter/r/b5a626/32.png) [@Raj4](https://forum.katalon.com/u/Raj4)\
**Post date:** [August 17, 2018, 5:41pm UTC](https://forum.katalon.com/t/get-session-cookie-in-sendrequest-item/6593/8 "2018-08-17T17:41:55Z")

</div>

Haven’t set any cookie, Just setup the RESTful API in different calls and when try to run individually one gets passed and other fails. Is there possibility how can I disable/delete cookies for different calls.
