VMware Cloud Community
CathyBr
Enthusiast
Enthusiast
Jump to solution

How to schedule a workflow using the VRO REST-api

Hi

Our WebClient plug-in starts workflows using the VRO REST api.  Now we want to be able to schedule the execution of the workflow.  I have seen that this functionality is availabe in the VRO itself, but can not find anything in the REST-api to do this.

Is this functionality available?

thanks

Cathy

1 Solution

Accepted Solutions
iiliev
VMware Employee
VMware Employee
Jump to solution

Hi Cathy,

To schedule workflow execution, you need to do a POST request to https://{vroaddress}:8281/vco/api/tasks

In the request body, you need to provide schedule details. Here is a sample XML body showing how to schedule a simple workflow having no input parameters:

<task xmlns="http://www.vmware.com/vco">

    <name>Schedule test</name>

    <recurrence-cycle>one-time</recurrence-cycle>

    <recurrence-start-date>2017-09-01T11:52:00+03:00</recurrence-start-date>

    <workflow href="http://10.20.61.24:8281/vco/api/workflows/13fc268a-7a87-4c32-a6e6-93c825822f57/"></workflow>

    <start-mode>normal</start-mode>

</task>

View solution in original post

6 Replies
iiliev
VMware Employee
VMware Employee
Jump to solution

Hi Cathy,

To schedule workflow execution, you need to do a POST request to https://{vroaddress}:8281/vco/api/tasks

In the request body, you need to provide schedule details. Here is a sample XML body showing how to schedule a simple workflow having no input parameters:

<task xmlns="http://www.vmware.com/vco">

    <name>Schedule test</name>

    <recurrence-cycle>one-time</recurrence-cycle>

    <recurrence-start-date>2017-09-01T11:52:00+03:00</recurrence-start-date>

    <workflow href="http://10.20.61.24:8281/vco/api/workflows/13fc268a-7a87-4c32-a6e6-93c825822f57/"></workflow>

    <start-mode>normal</start-mode>

</task>

marcseitz
Enthusiast
Enthusiast
Jump to solution

You can find a lot of information of how to use the REST-api here:

https://<YOUR-VRO-SERVER>:8281/vco/api/docs/index.html

CathyBr
Enthusiast
Enthusiast
Jump to solution

Thanks for the answers guys,

Of course I checked the api documentation before I asked, but could not find any mention about it. Maybe I missed it.

0 Kudos
venkatklr1
Contributor
Contributor
Jump to solution

Hi,

I am using below script to create schedule task. this will create schedule task for work which do not have common parameters, Can you please help me how can I provide common parameters using below script

  1. <task xmlns="http://www.vmware.com/vco"> 
  2.     <name>Schedule test</name> 
  3.     <recurrence-cycle>one-time</recurrence-cycle> 
  4.     <recurrence-start-date>2017-09-01T11:52:00+03:00</recurrence-start-date> 
  5.     <workflow href="http://10.20.61.24:8281/vco/api/workflows/13fc268a-7a87-4c32-a6e6-93c825822f57/"></workflow> 
  6.     <start-mode>normal</start-mode> 
  7. </task>
0 Kudos
iiliev
VMware Employee
VMware Employee
Jump to solution

Hi,

Parameters can be provided with <input-parameters> section. Here is an example showing a couple of input parameters - a datacenter object and a string (named myDatacenter and myString😞

<task xmlns="http://www.vmware.com/vco">

    <name>Schedule test</name>

    <recurrence-cycle>one-time</recurrence-cycle>

    <recurrence-start-date>2017-12-21T11:52:00+03:00</recurrence-start-date>

    <workflow href="http://10.20.61.24:8281/vco/api/workflows/13fc268a-7a87-4c32-a6e6-93c825822f57/"></workflow>

    <start-mode>normal</start-mode>

    <input-parameters>

        <parameter type="VC:Datacenter" name="myDatacenter" scope="local">

            <sdk-object type="VC:Datacenter" id="10.20.32.67/datacenter-2"/>

        </parameter>

        <parameter type="string" name="myString" scope="local">

            <string>myString</string>

        </parameter>

    </input-parameters>

</task>

Of course, the number of parameters and their type depend on the workflow being scheduled. At a minimum, you must provide the parameters marked as required in the workflow presentation, the other parameters are optional.

venkatklr1
Contributor
Contributor
Jump to solution

Ilian Iliev,

Thank you. I will try this option and will let you know if I have any issues.

0 Kudos