API call runbook and pass variables | Nutanix Community
Skip to main content

I have the same question as in topic (https://next.nutanix.com/calm-application-management-55/passing-variables-to-calm-runbooks-39356)

I have created a runbook, configured a variable  under the “Configuration” section of the runbook.

I can launch the runbook via API, but it does not pass the value.
I tried passing the below sample as the body of the request.

What am I missing ? 

 

{
"spec": {
"args": a
{
"name": "VariableName",
"value": "value"
}
]
}
}

 

Hi Peter,

I have tested again and it is working for me. Steps to reproduce:

  1. Create a runbook with a single Execute Escript task that has: 
    print(“@@{VAR_TEST}@@”)
  2. Add in the runbook a variable called VAR_TEST and enable runtime icon

     

  3. Gather the UUID for the runbook from the URL on the top

     

  4. With Postman or curl, run a POST call to https://PC_IP:9440/api/nutanix/v3/runbooks/<runbook_uuid>/run with body that has:
    {
    "spec": {
    "args":
    {
    "name": "VAR_TEST",
    "value": "THIS IS A TEST"
    }
    ]
    }
    }

     


The issue was caused by the fact I did not enable the “enable runtime”  option.

 

Many thanks for the prompt reply!