Hi All,
My usecase is to stop workflow till it is approved/rejected by external system(servicenow). The workflow is using "User Interaction" to wait for approval/rejection of the request. The external system(servicenow) makes REST call to the flow. I am following the link "http://pubs.vmware.com/vsphere-51/index.jsp#com.vmware.vsphere.vco_develop_web_services.doc/GUID-AF6..."
As per the link make a POST request to the user interaction instance for the particular workflow execution:
POST https://{vcoHost}:{port}/api/workflows/{workflowID}/executions/{executionID}/interaction/
I am making POST to /api/workflows/2700308b-ea6c-4c40-ae64-99ef97fb8154/executions/ff80808147b7443e014813261fb92d62/interaction/
with the request body
<execution-context xmlns="http://www.vmware.com/vco">
<parameters>
<parameter name="Status" type="string">
<string>Approved</string>
</parameter>
</parameters>
</execution-context>
where 2700308b-ea6c-4c40-ae64-99ef97fb8154 -> workflow id & ff80808147b7443e014813261fb92d62 -> running instance id. Is it required to pass UserInteractionID ?
It returns the following
<Response xmlns="https://labvcot30.entdev.addev.ntrs.com/vco/api/workflows/2700308b-ea6c-4c40-ae64-99ef97fb8154/execu...">
<href>https://labvcot30.entdev.addev.ntrs.com:8281/vco/api/workflows/2700308b-ea6c-4c40-ae64-99ef97fb8154/...</href>
<input-parameters>
<e>
<name>Status</name>
<type>string</type>
</e>
</input-parameters>
<name>Linux Stub : SNApproval</name>
<relations>
<link>
<e>
<href>https://labvcot30.entdev.addev.ntrs.com:8281/vco/api/workflows/2700308b-ea6c-4c40-ae64-99ef97fb8154/...</href>
<rel>up</rel>
</e>
<e>
<href>https://labvcot30.entdev.addev.ntrs.com:8281/vco/api/workflows/2700308b-ea6c-4c40-ae64-99ef97fb8154/...</href>
<rel>down</rel>
</e>
<e>
<href>https://labvcot30.entdev.addev.ntrs.com:8281/vco/api/workflows/2700308b-ea6c-4c40-ae64-99ef97fb8154/...</href>
<rel>add</rel>
</e>
</link>
</relations>
<state>waiting</state>
</Response>
Any help appreciated.
Interaction ID is not the same as execution ID.
I have to check what exactly is written in the official documentation, but I think you can answer the user interaction by POST-ing to
https://<host>:<port>/vco/api/workflows/{workflowId}/executions/{executionId}/interaction/
not to
http://<host>:<port>/vco/api/workflows/{workflowId}/executions/{executionId}}/interaction/presentation/instances/{presentationExecutionId}
and as execution id, pass the workflow execution id.
(You can get this URL as a link href if you get the interaction as <user-interaction> object from the <inventory-item> object from GET https://xxxxxx.com:8281/vco/api/catalog/System/UserInteraction/ff80808147b7443e0148182e448f2ff5)
Satish, is this vCO 5.1 or 5.5.x? It looks like you are answering interaction using 5.1 style URL but your vCO server is in fact 5.5.x
If this is vCO 5.5.x, I'd recommend first to check POST to
POST https://{vcoHost}:{port}/vco/api/workflows/{workflowID}/executions/{executionID}/interaction/
instead of
POST https://{vcoHost}:{port}/api/workflows/{workflowID}/executions/{executionID}/interaction/
(note the /vco part after the port).
Thanks llian for the response.
We are on 5.5.
The API doc on 5.5 has the following url for answering user interaction.
http://<host>:<port>/api/workflows/{workflowId}/executions/{executionId}}/interaction/presentation/instances/{presentationExecutionId}
I got the presentationExecutionId by executing https://xxxx.com:8281/vco/api/catalog/System/UserInteraction?status=0. It returned 5 responses. I was interested in the following user interaction object. I got the presentationExecutionId(ff80808147b7443e0148182e448f2ff5) from the following
<e>
<attributes>
<e>
<name>id</name>
<value>ff80808147b7443e0148182e448f2ff5</value>
</e>
<e>
<name>description</name>
</e>
<e>
<name>name</name>
<value>Linux Stub : SNApproval</value>
</e>
<e>
<name>state</name>
<value>waiting</value>
</e>
<e>
<name>createDate</name>
<value>2014-08-27T10:55:58.479-05:00</value>
</e>
<e>
<name>type</name>
<value>WorkflowInput</value>
</e>
</attributes>
<href>https://xxxxxx.com:8281/vco/api/catalog/System/UserInteraction/ff80808147b7443e0148182e448f2ff5/</href>
<rel>down</rel>
</e>
The following REST is executed to answer user interaction.
POST https://xxxxxxx.com:8281/vco/api/workflows/2700308b-ea6c-4c40-ae64-99ef97fb8154/executions/ff8080814... HTTP/1.1
User-Agent: Fiddler
Host: xxxxxx.com:8281
Content-Length: 266
Accept: application/xml
Content-Type: application/xml
Authorization: Basic c3AxNDhAZW50ZGV2LmFkZGV2Lm50cnMuY29tOlBAdGlsMQ==
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<execution-context xmlns="http://www.vmware.com/vco">
<parameters>
<parameter name="Status" type="string">
<string>Approved</string>
</parameter>
</parameters>
</execution-context>
Now the response is http 404 "Execution not found for execution id: ff80808147b7443e0148182e448f2ff5"
Any help appreciated.
Interaction ID is not the same as execution ID.
I have to check what exactly is written in the official documentation, but I think you can answer the user interaction by POST-ing to
https://<host>:<port>/vco/api/workflows/{workflowId}/executions/{executionId}/interaction/
not to
http://<host>:<port>/vco/api/workflows/{workflowId}/executions/{executionId}}/interaction/presentation/instances/{presentationExecutionId}
and as execution id, pass the workflow execution id.
(You can get this URL as a link href if you get the interaction as <user-interaction> object from the <inventory-item> object from GET https://xxxxxx.com:8281/vco/api/catalog/System/UserInteraction/ff80808147b7443e0148182e448f2ff5)
Thanks llian.
I am able to get it working by posting to the url https://<host>:<port>/vco/api/workflows/{workflowId}/executions/{executionId}/interaction/