UCSD Call a Workflow via API

Version 10

    This is an example on how to call a workflow via an API call.

     

    The workflow has two inputs A1 and A2:

     

    Screen Shot 2014-12-09 at 3.14.54 PM.png

     

    Screen Shot 2014-12-09 at 3.13.21 PM.png

     

    The workflow:

     

    Screen Shot 2014-12-09 at 3.13.11 PM.png

     

    The API call:

     

    http://172.17.32.155/app/api/rest?formatType=json&opName=userAPISubmitWorkflowServiceRequest&opData={param0:"TestWorkFlowFromAPI",param1:{"list":[{"name":"A1","value":"Happy"},{"name":"A2","value":"Holidays"}]},param2:-1}

     

     

    Screen Shot 2014-12-09 at 2.50.16 PM.png

     

    Curl Example (Thank you Sangeeta Narang):

     

    HTTP

    curl  -v -X POST -H 'X-Cloupia-Request-Key:5CF4C115F0034B189616B2B8EBA0F220'  -g 'http://172.17.32.75/app/api/rest?formatType=json&opName=userAPISubmitWorkflowServiceRequest&opData={param0:"TestWorkFlowFromAPI",param1:{"list":[{"name":"A1","value":"Hello"},{"name":"A2","value":"World"}]},param2:-1}'


     

    HTTPS

    curl --insecure -v -X POST -H 'X-Cloupia-Request-Key:5CF4C115F0034B189616B2B8EBA0Fxxx'  -g 'https://172.17.32.75/app/api/rest?formatType=json&opName=userAPISubmitWorkflowServiceRequest&opData={param0:"TestWorkFlowFromAPI",param1:{"list":[{"name":"A1","value":"Hello"},{"name":"A2","value":"World"}]},param2:-1}'


    NOTE:

     

    For testing purpose use above command in insecure mode, otherwise install cacert in your system and use cert location in curl call using —cacert curl option.



    In case there is a space in the Variable name:


     

    curl --insecure -v -X POST -H 'X-Cloupia-Request-Key:C97B881CE6B94DFB930765F7AC408xxx'  -g 'https://172.31.234.127/app/api/rest?formatType=json&opName=userAPISubmitWorkflowServiceRequest&opData={param0:"AddUCSMvlanv1",param1:{"list":[{"name":"VLAN%20ID","value":"500"},{"name":"VLAN%20DESC","value":"CURLvlantest"}]},param2:-1}'


    Roll back example:


     

    curl --insecure -v -X POST -H 'X-Cloupia-Request-Key:C97B881CE6B94DFB930765F7AC408xxx' -g 'https://172.31.234.127/app/api/rest?formatType=json&opName=userAPIRollbackWorkflow&opData={param0:140}'



     

    The execution in the log file:

     

    Screen Shot 2014-12-09 at 3.11.23 PM.png

     

    The resulting e-mail with the transferred input values:

     

    Screen Shot 2014-12-09 at 3.11.36 PM.png

     

    In this example I am logged on as admin and am using the same session to make the API call.  This way I already have the cookie.

     

     

    Obtaining the REST API Key

     

    http://<UCSD_IP>/app/api/rest?formatType=json&opName=userAPIGetRESTAccessKey&opData={param0:"whiter"}

     

     

     

    1. {

    2.     "serviceResult": "CAB614BF89194336A4147FB8DDEF5638",

    3.     "serviceError": null,

    4.     "serviceName": "InfraMgr",

    5.     "opName": "userAPIGetRESTAccessKey"

    6. }