I am trying to initiate a custom workflow in Orchestrator by issuing a POST from a client (in this case Fiddler) with the parameters in JSON format in the body.
So far i have been unable to get anything other than a 400 Bad Request and a "The request sent by the client was syntactically incorrect ()." in the response.
My environment is
vCenter Orchestrator 5.1.1 Build 2942
Java version 1.6.0.26
The Rest Plugin 1.0.1 is installed
To test that i am indeed able to initiate a workflow via a POST i tested with XML in the POST body just as a sanity check. Given a DataCenter TestDC2 i send the following
POST https://10.144.20.62:8281/api/workflows/d7614e92-0578-42b6-9c1f-04bd8a0533d3/executions/ HTTP/1.1
Authorization: Basic XXXXXXXXXXXXXXXXXXXX
User-Agent: Mozilla/5.0 (Windows NT; Windows NT 6.1; en-GB) WindowsPowerShell/3.0
Content-Type: application/xml
Host: 10.144.20.62:8281
Content-Length: 311
Connection: Keep-Alive
<execution-context xmlns="http://www.vmware.com/vco">
<parameters>
<parameter name="datacenterName" type="string">
<string>TestDC2</string>
</parameter>
<parameter name="customerVMFolder" type="string">
<string>aNewFolderVMFolder</string>
</parameter>
</parameters>
</execution-context>
I get a success response
HTTP/1.1 202 Accepted
ETag: "0d41d8cd98f00b204e9800998ecf8427e"
Content-Length: 0
Date: Wed, 03 Jul 2013 13:15:22 GMT
Server: vCO Server
and the folder "aNewFolderVMFolder" is created under TestDC2
The equivalent in JSON
POST https://10.144.20.62:8281/api/workflows/d7614e92-0578-42b6-9c1f-04bd8a0533d3/executions/ HTTP/1.1
Authorization: Basic XXXXXXXXXXXXXXXXXXXX
User-Agent: Mozilla/5.0 (Windows NT; Windows NT 6.1; en-GB) WindowsPowerShell/3.0
Content-Type: application/json
Host: 10.144.20.62:8281
Content-Length: 173
Connection: Keep-Alive
{
"parameters": [
{"name":"datacenterName", "type":"string","value":"TestDC2"},
{"name":"customerVMFolder", "type":"string","value":"aNewFolderVMFolder"}
]
}
gives a bad request
HTTP/1.1 400 Bad Request
Content-Type: text/html;charset=utf-8
Content-Length: 965
Date: Wed, 03 Jul 2013 13:21:02 GMT
Connection: close
Server: vCO Server
<html><head><title>JBossWeb/2.0.1.GA - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 400 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The request sent by the client was syntactically incorrect ().</u></p><HR size="1" noshade="noshade"><h3>JBossWeb/2.0.1.GA</h3></body></html>
after reading
i also tried
POST https://10.144.20.62:8281/api/workflows/d7614e92-0578-42b6-9c1f-04bd8a0533d3/executions/ HTTP/1.1
Authorization: Basic YWRtaW46U2E1YWRtMW4=
User-Agent: Mozilla/5.0 (Windows NT; Windows NT 6.1; en-GB) WindowsPowerShell/3.0
Content-Type: application/json
Host: 10.144.20.62:8281
Content-Length: 266
Connection: Keep-Alive
{
"parameters": [
{"name":"datacenterName", "type":"string","scope":"local","value":{"value":"TestDC2", "objectType":"string"}},
{"name":"customerVMFolder", "type":"string","scope":"local","value": {"value":"KamTestFolder","objectType":"string"}}
]
}
with exactly the same results
What am i doing wrong?