How to pass extra_var and inventory in awx launch job template api using curl

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
},

Hello ,

You can try to use the command below:

$ 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

Please let us know if that helps you.

Best Regards,
~mmello

could some one help me here?

The extra_vars working fine with json format however how to combine with Inventory?

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.

I am able use both extra_vars and inventory. Thanks for your help.

{
“extra_vars”: {
“mount_path”:“/mnt”,
“mount_source”:“filer.example.com:/vol01/qtree01”
},
“inventory”: 2
}