# API Call output via Ansible URI Module Not Getting the Complete Output

**URL:** <https://forum.ansible.com/t/api-call-output-via-ansible-uri-module-not-getting-the-complete-output/31904>\
**Category:** Ansible Project\
**Created:** [January 6, 2020, 8:33am UTC](https://forum.ansible.com/t/api-call-output-via-ansible-uri-module-not-getting-the-complete-output/31904 "2020-01-06T08:33:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pradeep\_Antil](https://avatars.discourse-cdn.com/v4/letter/p/b77776/32.png) [@Pradeep\_Antil](https://forum.ansible.com/u/Pradeep_Antil)\
**Post date:** [January 6, 2020, 8:33am UTC](https://forum.ansible.com/t/api-call-output-via-ansible-uri-module-not-getting-the-complete-output/31904/1 "2020-01-06T08:33:50Z")

</div>

Hi Team,

I have a small playbook which connects to InfoBlox Server and collects useful data via API and then save API commands out to variable and later redirecting variable output to a log file.

Issue is that Variable is not getting all output but it captures only fraction of output. Any idea and suggestion how to capture complete output of API call and save it in log file in formatted way , just like Jason

Below is playbook:

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [January 6, 2020, 9:25am UTC](https://forum.ansible.com/t/api-call-output-via-ansible-uri-module-not-getting-the-complete-output/31904/2 "2020-01-06T09:25:30Z")

</div>

Have a look at the return\_content parameter of the uri module

---

<div class="post-metadata">

**Author:** ![Pradeep\_Antil](https://avatars.discourse-cdn.com/v4/letter/p/b77776/32.png) [@Pradeep\_Antil](https://forum.ansible.com/u/Pradeep_Antil)\
**Post date:** [January 6, 2020, 10:40am UTC](https://forum.ansible.com/t/api-call-output-via-ansible-uri-module-not-getting-the-complete-output/31904/3 "2020-01-06T10:40:27Z")

</div>

Thank You Very Much, it resolves my output capture issue.

Now content is saved in log file with the following format, is there any way to format that data while saving it a file. As you can see in the output below, in place of new line \n is printed.

{‘content’: '{\n “result”: [\n {\n “\_ref”: "member/bxxxxxxxxxxxxxx, \n “config\_addr\_type”: “IPV4”, \n “host\_name”: “xxxxxxxxxxxxxxxxxxxxxx”, \n “node\_info”: [\n {\n “ha\_status”: “NOT\_CONFIGURED”, \n “hwid”: “892A5BA7A1CB4AA9BEAB99A3ECC81116”, \n “hwmodel”: “”, \n “hwplatform”: “KVM”, \n “hwtype”: “IB-V825”, \n “lan2\_physical\_setting”: {\n “auto\_port\_setting\_enabled”: true\n }, \n “lan\_ha\_port\_setting”: {\n “ha\_port\_setting”: {\n “auto\_port\_setting\_enabled”: true, \n “speed”: “10”\n }, \n “lan\_port\_setting”: {\n “auto\_port\_setting\_enabled”: true\n }\n }, \n “mgmt\_network\_setting”: {\n “address”: “xxxxxxx”, \n “gateway”: “xxxxxxxx”, \n “subnet\_mask”: “255.255.255.248”\n }, \n “mgmt\_physical\_setting”: {\n “auto\_port\_setting\_enabled”: true\n }, \n “paid\_nios”: false, \n “physical\_oid”: “0”, \n “service\_status”: [\n {\n “description”: “Running”, \n “service”: “NODE\_STATUS”, \n “status”: “WORKING”\n }, \n {\n “description”: “2% - Primary drive usage is OK.”, \n “service”: “DISK\_USAGE”, \n “status”: “WORKING”\n }, \n {\n “description”: “10.250.169.140”, \n “service”: “ENET\_LAN”, \n “status”: “WORKING”\n }, \n {\n “description”: “xxxxxxx”, \n “service”: “ENET\_LAN2”, \n “status”: “WORKING”\n }, \n {\n “description”: “10.250.169.132”, \n “service”: “ENET\_MGMT”, \n “status”: “WORKING”\n }, \n {\n “description”: "3% - Data

---

<div class="post-metadata">

**Author:** ![Vivek\_Kothawale](https://avatars.discourse-cdn.com/v4/letter/v/ea666f/32.png) [@Vivek\_Kothawale](https://forum.ansible.com/u/Vivek_Kothawale)\
**Post date:** [January 6, 2020, 10:46am UTC](https://forum.ansible.com/t/api-call-output-via-ansible-uri-module-not-getting-the-complete-output/31904/4 "2020-01-06T10:46:05Z")

</div>

Hi pardeep,

You can use filter module of ansible to get ouput in from of yaml or json

Best regards,  
Vivek

---

<div class="post-metadata">

**Author:** ![Pradeep\_Antil](https://avatars.discourse-cdn.com/v4/letter/p/b77776/32.png) [@Pradeep\_Antil](https://forum.ansible.com/u/Pradeep_Antil)\
**Post date:** [January 6, 2020, 11:24am UTC](https://forum.ansible.com/t/api-call-output-via-ansible-uri-module-not-getting-the-complete-output/31904/5 "2020-01-06T11:24:23Z")

</div>

Thanks Vivek, your suggestion was very helpful and it resolves formatting issue
