Is it possible to send an object as input parameter, for example vCloud:VM when you execute a workflow over the rest api? String and number works perfectly fine...
I have a c# application where I list some vCloud:VMs via the vCloud Director REST Api. Can i pull some info out from this and send to the Orchestrator for it to find the object?
Thanks!!
Yes, it is possible.
Here is a sample XML request body showing how the workflow 'Rename datacenter' can be invoked
<execution-context xmlns="http://www.vmware.com/vco">
<parameters>
<parameter name="datacenter" type="VC:Datacenter" description="Datacenter to rename">
<sdk-object id="myvcenter.eng.vmware.com/datacenter-2" type="VC:Datacenter" />
</parameter>
<parameter name="newName" type="string" description="New datacenter name">
<string>sample new name</string>
</parameter>
</parameters>
</execution-context>
Such objects that come from plug-ins are passed as sdk-object parameter. You need to know the object type as defined by the plug-in (eg. VC:Datacenter or vCloud:VM) and object ID
Yes, it is possible.
Here is a sample XML request body showing how the workflow 'Rename datacenter' can be invoked
<execution-context xmlns="http://www.vmware.com/vco">
<parameters>
<parameter name="datacenter" type="VC:Datacenter" description="Datacenter to rename">
<sdk-object id="myvcenter.eng.vmware.com/datacenter-2" type="VC:Datacenter" />
</parameter>
<parameter name="newName" type="string" description="New datacenter name">
<string>sample new name</string>
</parameter>
</parameters>
</execution-context>
Such objects that come from plug-ins are passed as sdk-object parameter. You need to know the object type as defined by the plug-in (eg. VC:Datacenter or vCloud:VM) and object ID
Thanks for the answer.
It works fine with the datacenter as example. I am now trying to send a vCloud:Vm object like this but without success.
<execution-context xmlns="http://www.vmware.com/vco">
<parameters>
<parameter name="VM" type="vCloud:VM">
<sdk-object id="urn:vcloud:vm:e307d316-12c5-4d7d-81ce-5c0265026cbf" type="vCloud:VM" />
</parameter>
</parameters>
</execution-context>
I have also been trying with vcdcell.fqdn/urn:vcloud:vm:e307d316-12c5-4d7d-81ce-5c0265026cbf without success. The workflow starts but the variable has no object.
Any hint? Thanks!
If you have not already, you should read my article here: http://bit.ly/restvco - I teach you the technique to learn how to find proper format of complex objects – essentially, you run a workflow in Orchestrator that uses the object type in question, then view the workflow token.
I just used the technique described in that article to look at a workflow execution that had a vCloud:VM as one of the inputs, as you can see from my output below, the parameters section's sdk-object includes the href, yours does not:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<workflow-execution xmlns="http://www.vmware.com/vco" href="https://192.168.1.22:8281/vco/api/workflows/87808080808080808080808080808080FD80808001319116876531ae...">
<relations>
<link href="https://192.168.1.22:8281/vco/api/workflows/87808080808080808080808080808080FD80808001319116876531ae..." rel="up"/>
<link href="https://192.168.1.22:8281/vco/api/workflows/87808080808080808080808080808080FD80808001319116876531ae..." rel="remove"/>
<link href="https://192.168.1.22:8281/vco/api/workflows/87808080808080808080808080808080FD80808001319116876531ae..." rel="logs"/>
<link href="https://192.168.1.22:8281/vco/api/workflows/87808080808080808080808080808080FD80808001319116876531ae..." rel="state"/>
</relations>
<id>ff8080814fbd25b601501a073f88018e</id>
<state>completed</state>
<input-parameters>
<parameter type="vCloud:VM" name="vm" scope="local">
<sdk-object type="vCloud:VM" href="https://192.168.1.22:8281/vco/api/catalog/vCloud/VM/705e45203447a36a2782152eb0a4a974d595de1a8acffc9e..." id="705e45203447a36a2782152eb0a4a974d595de1a8acffc9ef1eec3b971aaa5////https://p3v2-vcd.vchs.vmware.com:443/api/vApp/vm-995b17af-f85e-43ae-92f7-9524a9920eb9"/>
</parameter>
<parameter type="boolean" name="accessToVcenter" scope="local">
<boolean>false</boolean>
</parameter>
</input-parameters>
<output-parameters/>
<start-date>2015-09-29T12:54:54.087-04:00</start-date>
<end-date>2015-09-29T12:55:01.245-04:00</end-date>
<started-by>Administrator@VSPHERE.LOCAL</started-by>
<name>Test vCloud VM</name>
</workflow-execution>
You should do the same thing in your environment to ensure you get the proper formatting of your sdk-object string.
hrefs are not absolutely necessary; using type and id instead of href should produce equivalent results.
The problem is in the format of the ID. In frefal sample the ID has the following format:
id="urn:vcloud:vm:e307d316-12c5-4d7d-81ce-5c0265026cbf"
and in Burke's sample the ID is in format recognizable by vCloud plug-in for VRO:
id="705e45203447a36a2782152eb0a4a974d595de1a8acffc9ef1eec3b971aaa5////https://p3v2-vcd.vchs.vmware.com:443/api/vApp/vm-995b17af-f85e-43ae-92f7-9524a9920eb9"
Thanks for the answers. I will read thru the post.
But I am a bit confused, what you are saying here is that the VCD rest api is not giving me any information from the vCloud:VM object that the VRO would recognize/accept. So I will have to drill down the VRO inventory to find the object id?