# Read system.net.httpPost TOKEN

**URL:** <https://forum.inductiveautomation.com/t/read-system-net-httppost-token/64798>\
**Category:** Ignition\
**Created:** [October 4, 2022, 2:18pm UTC](https://forum.inductiveautomation.com/t/read-system-net-httppost-token/64798 "2022-10-04T14:18:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aiasa21](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@Aiasa21](https://forum.inductiveautomation.com/u/Aiasa21)\
**Post date:** [October 4, 2022, 2:18pm UTC](https://forum.inductiveautomation.com/t/read-system-net-httppost-token/64798/1 "2022-10-04T14:18:24Z")

</div>

Good afternoon,  
I'm calling a huawei solar system with API using this code

```auto
# Real time data
token = "myToken"

url = "https://eu5.fusionsolar.huawei.com/thirdData/getStationRealKpi"
payload = { "stationCodes":"xxxx" }
header = { "XSRF-TOKEN":token }

response = system.net.httpPost( url, contentType='application/json; charset=utf-8', postData=system.util.jsonEncode(payload), headerValues = header, bypassCertValidation = True )
res_RealTime = system.util.jsonDecode(response)

```

My problem is that I have to log in and read the token that is present in the cookies. With POSTMAN I can read it without problem as in picture

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/a/dab337a4e34cb1073c240d88bece9f9ab2417393.png)

but with this code

```auto
url = "https://eu5.fusionsolar.huawei.com/thirdData/login"
payload = {"userName": "myUser","systemCode": "myCode"}

response = system.net.httpPost( url, contentType='application/json; charset=utf-8', postData=system.util.jsonEncode(payload), bypassCertValidation = True )

print response

```

I don't know how to read that because I don't have it in the response.

Thanks for the help

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [October 4, 2022, 2:48pm UTC](https://forum.inductiveautomation.com/t/read-system-net-httppost-token/64798/2 "2022-10-04T14:48:55Z")

</div>

Using [`system.net.httpClient`](http://files.inductiveautomation.com/sdk/javadoc/ignition80/8.0.12/com/inductiveautomation/ignition/common/script/builtin/http/JythonHttpClient.html) instead, you should be able to get a [`response` object](http://files.inductiveautomation.com/sdk/javadoc/ignition80/8.0.12/com/inductiveautomation/ignition/common/script/builtin/http/Response.html), which has a `getHeaders` method.  
You should be able to retrieve cookies from the headers.

---

<div class="post-metadata">

**Author:** ![Aiasa21](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@Aiasa21](https://forum.inductiveautomation.com/u/Aiasa21)\
**Post date:** [October 6, 2022, 11:20am UTC](https://forum.inductiveautomation.com/t/read-system-net-httppost-token/64798/3 "2022-10-06T11:20:13Z")

</div>

Thanks for the help.

If can be useful this is how I make it work

```auto
client = system.net.httpClient(bypass_cert_validation=True)
res = client.post("https://eu5.fusionsolar.huawei.com/thirdData/login",data = {"userName": "myUser","systemCode": "myCode"})
tmp = res.getHeaders()
token = tmp['xsrf-token'][0]

```
