# fail to use uri to POST file to a service

**URL:** <https://forum.ansible.com/t/fail-to-use-uri-to-post-file-to-a-service/17907>\
**Category:** Ansible Project\
**Created:** [April 4, 2015, 7:26pm UTC](https://forum.ansible.com/t/fail-to-use-uri-to-post-file-to-a-service/17907 "2015-04-04T19:26:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tzach\_Livyatan1](https://avatars.discourse-cdn.com/v4/letter/t/9fc29f/32.png) [@Tzach\_Livyatan1](https://forum.ansible.com/u/Tzach_Livyatan1)\
**Post date:** [April 4, 2015, 7:26pm UTC](https://forum.ansible.com/t/fail-to-use-uri-to-post-file-to-a-service/17907/1 "2015-04-04T19:26:00Z")

</div>

Hello  
The following curl from the host to the provision servers works fine:

`  
curl -X POST --header “Content-Type: application/json” -d @file.json [http://public-ip/api](http://public-ip/api)

`

Trying to use uri module for the same, I used:

`

- local\_action: uri url=[http://public-ip/api](http://public-ip/api) method=POST body=“{{ lookup(‘file’,‘file.json’) }}” HEADER\_Content-Type=“application/json”  
sudo: false

`

Only to get

`  
msg: this module requires key=value arguments

`

Any idea whats going on here?  
Thanks

---

<div class="post-metadata">

**Author:** ![Romeo\_Theriault](https://avatars.discourse-cdn.com/v4/letter/r/839c29/32.png) [@Romeo\_Theriault](https://forum.ansible.com/u/Romeo_Theriault)\
**Post date:** [April 6, 2015, 1:50am UTC](https://forum.ansible.com/t/fail-to-use-uri-to-post-file-to-a-service/17907/2 "2015-04-06T01:50:27Z")

</div>

Try changing the body to something simple and seeing if it works. I’m guessing that something inside of the file.json that is causing a parse error. One option is to put the contents of the file.json directly into the body=“{ jsonk: ‘jsonv’, }”

Hope that helps.
