# uri module: fails to do POST due to unable to parse netscape cookie file

**URL:** <https://forum.ansible.com/t/uri-module-fails-to-do-post-due-to-unable-to-parse-netscape-cookie-file/28297>\
**Category:** Ansible Project\
**Created:** [August 9, 2018, 6:26am UTC](https://forum.ansible.com/t/uri-module-fails-to-do-post-due-to-unable-to-parse-netscape-cookie-file/28297 "2018-08-09T06:26:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vinod\_kumar4](https://avatars.discourse-cdn.com/v4/letter/v/779978/32.png) [@vinod\_kumar4](https://forum.ansible.com/u/vinod_kumar4)\
**Post date:** [August 9, 2018, 6:26am UTC](https://forum.ansible.com/t/uri-module-fails-to-do-post-due-to-unable-to-parse-netscape-cookie-file/28297/1 "2018-08-09T06:26:05Z")

</div>

I have below uri module where i am sending netscape cookie file.  
It throws me back with error message,

- name: Register  
uri:  
url: “https://{{ orch\_ip }}:19443/2/platforms/xxx/providers”  
method: POST  
return\_content: yes  
body: ‘u{{ isilon\_orch\_service\_account\_key }}’  
body\_format: json  
validate\_certs: no  
status\_code: 200,204  
headers:  
Cookie: ‘u{{ isilon\_orch\_cookie\_file }}’

I get below error message:

TASK [Register] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
task path: /etc/ansible/playbooks/deploy\_1.yml:48  
fatal: [10.150.0.15]: FAILED! =\> {“changed”: false, “connection”: “close”, “content”: “\n\<html lang="en"\>\n \n Bad Request\n \n html, body, pre {\n margin: 0;\n padding: 0;\n font-family: Monaco, ‘Lucida Console’, monospace;\n background: #ECECEC;\n }\n h1 {\n margin: 0;\n background: #AD632A;\n padding: 20px 45px;\n color: #fff;\n text-shadow: 1px 1px 1px rgba(0,0,0,.3);\n border-bottom: 1px solid #9F5805;\n font-size: 28px;\n }\n p#detail {\n margin: 0;\n padding: 15px 45px;\n background: #F6A960;\n border-top: 4px solid #D29052;\n color: #733512;\n text-shadow: 1px 1px 1px rgba(255,255,255,.3);\n font-size: 14px;\n border-bottom: 1px solid #BA7F5B;\n }\n \n \n \n

# Bad Request
\n\n \<p id="detail"\>\n For request ‘POST /2/platforms/xxx/providers’ [Bad request: Error decoding json body: com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'u': was expecting ('true', 'false' or 'null')\n at [Source: (akka.util.ByteIterator$ByteArrayIterator$$anon$1); line: 1, column: 3]]\n 

\n\n \n\n”, “content\_length”: “1424”, “content\_type”: “text/html; charset=utf-8”, “date”: “Thu, 09 Aug 2018 06:22:36 GMT”, “msg”: “Status code was not [200, 204]: HTTP Error 400: Bad Request”, “redirected”: false, “status”: 400, “url”: “[https://10.150.0.4:19443/2/platforms/xxx/providers](https://10.150.0.4:19443/2/platforms/xxx/providers)”}

below is {{ isilon\_orch\_cookie\_file }} file looks like

#HttpOnly\_10.150.0.4 FALSE / TRUE 0 PLAY\_SESSION eyJhbGciOiJIUzI1NiJ9.eyJkYXRhIjp7InRpbWUiOiIxNTMzNzk1NzU1MDY4IiwiVVVJRCI6IjI0MGIyInVzZXIiOiJhZG1pbiJ9zMzc5NTc1NX0.npAMiDyTLQIMZ1kV3A6oHlOjShdWo3nMzBRn7YjbI5A

Need help on what format of netscape cookie file should be allowed in uri to understand and authentiate

---

<div class="post-metadata">

**Author:** ![vinod\_kumar4](https://avatars.discourse-cdn.com/v4/letter/v/779978/32.png) [@vinod\_kumar4](https://forum.ansible.com/u/vinod_kumar4)\
**Post date:** [August 9, 2018, 6:29am UTC](https://forum.ansible.com/t/uri-module-fails-to-do-post-due-to-unable-to-parse-netscape-cookie-file/28297/2 "2018-08-09T06:29:31Z")

</div>

Running curl command as below works fine,

curl -X POST -k [https://10.150.0.4:19443/2/platforms/xxx/providers](https://10.150.0.4:19443/2/platforms/xxx/providers) -b ./cookie.txt --header “Content-Type:application/json” --data @key1.json
