# How to pass extra\_var and inventory in awx launch job template api using curl

**URL:** <https://forum.ansible.com/t/how-to-pass-extra-var-and-inventory-in-awx-launch-job-template-api-using-curl/36174>\
**Category:** AWX Project\
**Tags:** awx\
**Created:** [January 5, 2022, 2:46pm UTC](https://forum.ansible.com/t/how-to-pass-extra-var-and-inventory-in-awx-launch-job-template-api-using-curl/36174 "2022-01-05T14:46:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Selvam\_Elangovan](https://avatars.discourse-cdn.com/v4/letter/s/8c91f0/32.png) [@Selvam\_Elangovan](https://forum.ansible.com/u/Selvam_Elangovan)\
**Post date:** [January 5, 2022, 2:46pm UTC](https://forum.ansible.com/t/how-to-pass-extra-var-and-inventory-in-awx-launch-job-template-api-using-curl/36174/1 "2022-01-05T14:46:06Z")

</div>

Hi!

Shall I know how to pass extra\_var and inventory details as json format to curl command to awx api?

“defaults”: {  
“extra\_vars”: “—”,  
“diff\_mode”: false,  
“limit”: “”,  
“job\_tags”: “”,  
“skip\_tags”: “”,  
“job\_type”: “run”,  
“verbosity”: 2,  
“inventory”: {  
“name”: null,  
“id”: null  
},

---

<div class="post-metadata">

**Author:** ![Tchello\_Mello](https://avatars.discourse-cdn.com/v4/letter/t/bc79bd/32.png) [@Tchello\_Mello](https://forum.ansible.com/u/Tchello_Mello)\
**Post date:** [January 5, 2022, 8:29pm UTC](https://forum.ansible.com/t/how-to-pass-extra-var-and-inventory-in-awx-launch-job-template-api-using-curl/36174/2 "2022-01-05T20:29:48Z")

</div>

Hello ,

You can try to use the command below:

```auto
$ curl -f -d '{"extra_vars": "{\"foo\": \"bar\"}"} ' http://<tower.example.com>/api/v2/job_templates/1/callback

```

Another way is to create a JSON file and then pass it using `-d @my.json`

You can get more information at this page as well [https://reqbin.com/req/c-dwjszac0/curl-post-json-example](https://reqbin.com/req/c-dwjszac0/curl-post-json-example)

Please let us know if that helps you.

Best Regards,  
~mmello

---

<div class="post-metadata">

**Author:** ![Selvam\_Elangovan](https://avatars.discourse-cdn.com/v4/letter/s/8c91f0/32.png) [@Selvam\_Elangovan](https://forum.ansible.com/u/Selvam_Elangovan)\
**Post date:** [January 6, 2022, 5:22am UTC](https://forum.ansible.com/t/how-to-pass-extra-var-and-inventory-in-awx-launch-job-template-api-using-curl/36174/3 "2022-01-06T05:22:44Z")

</div>

could some one help me here?

The extra\_vars working fine with json format however how to combine with Inventory?

---

<div class="post-metadata">

**Author:** ![Selvam\_Elangovan](https://avatars.discourse-cdn.com/v4/letter/s/8c91f0/32.png) [@Selvam\_Elangovan](https://forum.ansible.com/u/Selvam_Elangovan)\
**Post date:** [January 6, 2022, 5:26am UTC](https://forum.ansible.com/t/how-to-pass-extra-var-and-inventory-in-awx-launch-job-template-api-using-curl/36174/4 "2022-01-06T05:26:17Z")

</div>

Thanks. Yes. It helps. the Json format for extra\_vars working fine however if we combine with inventory: it is not working. Any idea?

I want to pass extra\_vars and inventory details to api. Kindly help me here.

---

<div class="post-metadata">

**Author:** ![Selvam\_Elangovan](https://avatars.discourse-cdn.com/v4/letter/s/8c91f0/32.png) [@Selvam\_Elangovan](https://forum.ansible.com/u/Selvam_Elangovan)\
**Post date:** [January 6, 2022, 6:06am UTC](https://forum.ansible.com/t/how-to-pass-extra-var-and-inventory-in-awx-launch-job-template-api-using-curl/36174/5 "2022-01-06T06:06:00Z")

</div>

I am able use both extra\_vars and inventory. Thanks for your help.

{  
“extra\_vars”: {  
“mount\_path”:“/mnt”,  
“mount\_source”:“[filer.example.com](http://filer.example.com):/vol01/qtree01”  
},  
“inventory”: 2  
}
