# REST API to add host to inventory for Ansible Tower is Not working!

**URL:** <https://forum.ansible.com/t/rest-api-to-add-host-to-inventory-for-ansible-tower-is-not-working/32714>\
**Category:** Ansible Project\
**Created:** [April 17, 2020, 1:40pm UTC](https://forum.ansible.com/t/rest-api-to-add-host-to-inventory-for-ansible-tower-is-not-working/32714 "2020-04-17T13:40:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vivek\_Mandal](https://avatars.discourse-cdn.com/v4/letter/v/ce73a5/32.png) [@Vivek\_Mandal](https://forum.ansible.com/u/Vivek_Mandal)\
**Post date:** [April 17, 2020, 1:40pm UTC](https://forum.ansible.com/t/rest-api-to-add-host-to-inventory-for-ansible-tower-is-not-working/32714/1 "2020-04-17T13:40:27Z")

</div>

Hi,  
&nbsp;&nbsp;&nbsp;I have been trying to execute a REST API to  
Add a host to an inventory.Below is the API.

/api/v2/inventories/{id}/hosts/

Unfortunately, This API doesn't work. It gives the response as 200(Ok). But only displays the existing host. Its the same response when you run GET method for the same API call. Can someone please help me rectifying the error.

Thanks,  
Vivek

---

<div class="post-metadata">

**Author:** ![racke](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/racke/32/4767_2.png) [@racke](https://forum.ansible.com/u/racke)\
**Post date:** [April 17, 2020, 2:00pm UTC](https://forum.ansible.com/t/rest-api-to-add-host-to-inventory-for-ansible-tower-is-not-working/32714/2 "2020-04-17T14:00:43Z")

</div>

Hello Vivek,

this list is for Ansible only, not for Tower or AWX.

Please contact Redhat support.

Regards  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Racke

---

<div class="post-metadata">

**Author:** ![ffirg](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/ffirg/32/10029_2.png) [@ffirg](https://forum.ansible.com/u/ffirg)\
**Post date:** [April 20, 2020, 5:03pm UTC](https://forum.ansible.com/t/rest-api-to-add-host-to-inventory-for-ansible-tower-is-not-working/32714/3 "2020-04-20T17:03:57Z")

</div>

Hi Vivek

As Stefan mentioned this list is not for AWX/Tower queries, BUT please take a look at either the tower-cli or awx-cli depending on your version and also the tower specific modules for doing such tasks. For instance, [https://docs.ansible.com/ansible/latest/modules/tower\_host\_module.html#tower-host-module](https://docs.ansible.com/ansible/latest/modules/tower_host_module.html#tower-host-module)

Regards  
Phil.
