Hey everybody,
i'm trying to start a workflow via a REST-POST-Call to Start a Virtual Maschine.
I use the HTTP ContentType "text/XML" and call via
"https://{vmhost}:{port}/vco/api/workflows/{workflowID}/executions/
and send the following httpBody:
<execution-context xmlns="http://www.vmware.com/vco">
<parameters>
<parameter name="vm" type="VC:VirtualMaschine">
<VC:VirtualMaschine>vm04711</VC:VirtualMaschine>
</parameter>
</parameters>
</execution-context>
but there are come back a Error-Message
"REST: HTTP POST request failed with error 400 (Bad Request)"
I don't know, if there parameters are in the httpBody are correct. The Input-Parameter in the Workflow has the Name "vm" with the type "VC:VirtualMaschine".
there is an example with string but with an VC:VirtualMaschine-Type, i don't know who are the Syntax is.
Could someone help me - thanks a lot
greetings
I've solved the Problem.
In the http Body, i don't get the IP of the vCenter-Server it is the DNS-Name. After that it works.
The id of the workflow was ok and also the id of the vm.
Thanks a lot for your support
Hi,
Here is a sample request body:
<execution-context xmlns="http://www.vmware.com/vco">
<parameters>
<parameter name="vm" type="VC:VirtualMachine">
<sdk-object type="VC:VirtualMachine" id="10.23.7.15/vm-8731" />
</parameter>
</parameters>
</execution-context>
10.23.7.15 above is the address of the vCenter where the virtual machine vm-8731 is managed.
Also, a few other remarks:
Thanks for your quick Response. When i modify your request Body to my Settings then the workflow start, but in the log of Orchestrator come back:
TypeError: Cannot read property "powerState" from undefined
Do you know what happend?
Which workflow are you trying to start? Is it an out-of-the-box workflow that comes with vRO, or is it your custom workflow? Also, which vRO version do you use?
It's a vRO-Workflow (Start virtual machine and wait) and i use vRO-Version 6.0.3
This is the Workflow "Start virtual machine and wait":
In the Main-Workflow there are an Error with the Value:
This error means the virtual machine with such ID cannot be found on the specified vCenter.
Could you provide the exact request body plus the exact command line you use to start the workflow?
Also, could you try to execute a GET request with a URL like the following, to see if the virtual machine can be found?
https://10.23.2.19:8281/vco/api/catalog/VC/VirtualMachine/10.23.7.15%252Fvm-8731/
in the above URL, 10.23.2.19 is the vRO server, 10.23.7.15 is the vCenter server, and vm-8731 is the ID of the virtual machine.
This is the request Body:
<execution-context xmlns="http://www.vmware.com/vco">
<parameters>
<parameter name="vm" type="VC:VirtualMachine">
<sdk-object type="VC:VirtualMachine" id="172.31.3.22/vm-730"/>
</parameter>
</parameters>
</execution-context>
When I start manually the Workflow it works. But in the Value-Parameter, i get back the Name of the Virtual Machine not the id!?
This workflow ID (8492...) is not the ID of the stock workflow 'Start virtual machine and wait'. Did you duplicate it?
REST API calls and manually executing the workflow via vRO Client UI are 2 completely different things.
In the value column, you are seeing the display value of the object; it is normal to see a name and not an ID there.
Also, were you able to find the virtual machine by making a GET request with the catalog API I provided in my previous post? If it doesn't find anything, then your REST call to start the workflow also won't be able to find the virtual machine. Most likely, you are not constructing the proper command line.
I've solved the Problem.
In the http Body, i don't get the IP of the vCenter-Server it is the DNS-Name. After that it works.
The id of the workflow was ok and also the id of the vm.
Thanks a lot for your support