# AWX / Tower: PUT multiple variables in inventory

**URL:** <https://forum.ansible.com/t/awx-tower-put-multiple-variables-in-inventory/27209>\
**Category:** AWX Project\
**Tags:** awx\
**Created:** [April 6, 2018, 3:46pm UTC](https://forum.ansible.com/t/awx-tower-put-multiple-variables-in-inventory/27209 "2018-04-06T15:46:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alex\_Kamalov](https://avatars.discourse-cdn.com/v4/letter/a/9de053/32.png) [@Alex\_Kamalov](https://forum.ansible.com/u/Alex_Kamalov)\
**Post date:** [April 6, 2018, 3:46pm UTC](https://forum.ansible.com/t/awx-tower-put-multiple-variables-in-inventory/27209/1 "2018-04-06T15:46:43Z")

</div>

Greetings folks,

Trying to PUT multiple variables into inventory, getting an error:

$ curl -H ‘Authorization:Token XXXXXXXXXXXXXXXXXX’ -f -k -H “content-Type: application/json” -X PATCH -d ‘{ “name”: “zookeepernodes”,“description”: “ZooKeeper Nodes for Kerberos Project”,“organization”: 16,“kind”: “”,“host\_filter”: null,“variables”: {“kafka\_user”: “tgam01m”,“kafka\_group”: “wtgakafk”,“zookeeper\_user”: “tgam01m”,“zookeeper\_group”: “zkgrp”,“ansible\_user”: “ans00001”,“ansible\_group”: “ans00001”,“topic\_schemas”: “\_connect\_DP-cnj-prod-connect\_schemas”,“topic\_connect\_configs”: “\_connect\_DP-cnj-prod-connect\_configs”,“topic\_connect\_offsets”: “\_connect\_DP-cnj-prod-connect\_offsets”,“topic\_connect\_status”: “\_connect\_DP-cnj-prod-connect\_status”,“zk\_port” : “2181”,“kafka\_port”: “9092”},“insights\_credential”: null }’ [http://awx-qa.localnet.net/api/v2/inventories/15/](http://awx-qa.localnet.net/api/v2/inventories/15/) | jq .

I am getting back the following:

curl: (22) The requested URL returned error: 400 Bad Request

Anyone knows how to upload multiple variables to AWX / Tower?

---

<div class="post-metadata">

**Author:** ![AlanCoding](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/alancoding/32/301_2.png) [@AlanCoding](https://forum.ansible.com/u/AlanCoding)\
**Post date:** [April 6, 2018, 4:15pm UTC](https://forum.ansible.com/t/awx-tower-put-multiple-variables-in-inventory/27209/2 "2018-04-06T16:15:59Z")

</div>

The 400 error probably has a detailed message that tells you what validation went wrong. If you POST the same thing in the API browser (add /api/v2/inventories/15/ to the URL), you can see the response message.

---

<div class="post-metadata">

**Author:** ![Alex\_Kamalov](https://avatars.discourse-cdn.com/v4/letter/a/9de053/32.png) [@Alex\_Kamalov](https://forum.ansible.com/u/Alex_Kamalov)\
**Post date:** [April 6, 2018, 5:11pm UTC](https://forum.ansible.com/t/awx-tower-put-multiple-variables-in-inventory/27209/3 "2018-04-06T17:11:07Z")

</div>

Thanks for reply Alan. Tried:

{  
“name”: “zookeepernodes”,  
“description”: “ZooKeeper Nodes for Kerberos Project”,  
“organization”: 16,  
“kind”: “”,  
“host\_filter”: null,  
“variables”: {  
“kafka\_user”: “ans00010”,  
“kafka\_group”: “ans00001”,  
“zookeeper\_user”: “zkuser01”,  
“zookeeper\_group”: “zkgrp”,  
“ansible\_user”: “ans00001”,  
“ansible\_group”: “ans00001”,  
“topic\_schemas”: “\_connect\_DP-cnj-prod-connect\_schemas”,  
“topic\_connect\_configs”: “\_connect\_DP-cnj-prod-connect\_configs”,  
“topic\_connect\_offsets”: “\_connect\_DP-cnj-prod-connect\_offsets”,  
“topic\_connect\_status”: “\_connect\_DP-cnj-prod-connect\_status”,  
“zk\_port”: “2181”,  
“kafka\_port”: “9092”  
},  
“insights\_credential”: null  
}

It’s giving me:

```auto
{
    "variables": [
        "Not a valid string."
    ]
}

```

It’s a valid JSON, I validated it. I did PUT, but no avail so far ☹

Alex

---

<div class="post-metadata">

**Author:** ![Alex\_Kamalov](https://avatars.discourse-cdn.com/v4/letter/a/9de053/32.png) [@Alex\_Kamalov](https://forum.ansible.com/u/Alex_Kamalov)\
**Post date:** [April 6, 2018, 6:04pm UTC](https://forum.ansible.com/t/awx-tower-put-multiple-variables-in-inventory/27209/4 "2018-04-06T18:04:16Z")

</div>

Answering my own question. Using the following syntax worked:

{  
“name”: “zookeepernodes”,  
“description”: “ZooKeeper Nodes for Kerberos Project”,  
“organization”: 16,  
“kind”: “”,  
“host\_filter”: null,  
“variables”: “{ kafka\_user: kafka00001, kafka\_group: kafkagrp, zookeeper\_user: zkuser00001, zookeeper\_group: zkgrp, ansible\_user: ans00001, ansible\_group: ans00001, topic\_schemas: \_connect\_DP-cnj-prod-connect\_schemas,topic\_connect\_configs: \_connect\_DP-cnj-prod-connect\_configs,topic\_connect\_offsets: \_connect\_DP-cnj-prod-connect\_offsets,topic\_connect\_status: \_connect\_DP-cnj-prod-connect\_status, zk\_port: 2181,kafka\_port: 9092}”,  
“insights\_credential”: null  
}
