Active IQ Unified Manager Discussions

how to call a workflow using REST with dynamic input

SHYAMVOLVO
3,025 Views

Hi NetApp team, 

 

we have workflow whose value are dynamically get selected depending on previous field input. 

 

for example , in the below flow, 

 

" Cluster"  value is depend in "Security Zone"  value  and "Vserver"  value is depend on "Cluster"  value. 

 

All this user input  are Query type .  only "security zone "  input need to be given , and based on that all other value get evaluated.

 

 

what I know is  in REST , we need to give static  user input  .

 

So, is there any   way where we can get the  input value dynamically using REST api  ? 

and also how can we get return value of the flow once its get finish its execution. 

if possible please provide some example so that it will be easy to understand. 

 

 

 

Capture.JPG

 

Thanks

Shyam

3 REPLIES 3

asulliva
3,008 Views

Hello @SHYAMVOLVO,

 

More or less, you're querying the REST endpoint at this location:

 

/workflows/{workflow_uuid}/user-input/{user_input_name}

To specify a value, you would use the standard HTTP GET nomenclature:

 

/workflows/{workflow_uuid}/user-input/{user_input_name}?input1=value1&input2=value2

 

You can see an example of this with vRealize Orchestrator here

 

 

Hope that helps!

 

Andrew

If this post resolved your issue, please help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

sinhaa
2,911 Views

@SHYAMVOLVO

 

You need to understand some basic stuff. 

 

If your workflow needs x number of Inputs, it will need those x inputs both from GUI and API for execution. The GUI has some background magic-logic that makes things easier for you by providing you ready-to-run default inputs. You change one input( Security Zone) and rest automatically gets filled.

 

But API is an advanced call, it will not have that magic logic for your rescue as you do in GUI. You will need to create the x-inputs in a formatted XML body for the worklfow to execute. This can be a difficult error prone task and it gets complicated if you have many and complex type of Inputs like Table or Query-Multi select.

 

 

So here is your resque ticket. For all the GUI lovers, use GUI to provide all your inputs. And get the equivalent XML formatted body with all inputs within seconds, Ready for execution using the API. Now just use it.

 

sinhaa Extraordinary Contributor How to generate the User-Input XML Body for executing workflows via REST APIs: The Solution 

 

 

sinhaa

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

SHYAMVOLVO
2,778 Views

@sinhaa 

thanks for your input . Now I understand . 

but I am getting an error when I tried to connect to WFA using REST .. 

 

I can access the WFA GUI using https   , but will trying with REST its give error. 

any idea what is this and how can I solve it ? 

 

below is the code I am using and WFA is running on 4.2  . 

 

 

 

# WFA server and credential


$WFAserver = "https://WFAserver/rest"
$username = "admin";
$password = "*********";

 

# the name of the workflow/filters


$workflowToExecute = "Find_cluster_by_ipspace"

$credential = New-Object System.Management.Automation.PSCredential ($username, (ConvertTo-SecureString $password -AsPlainText -Force))
[Net.ServicePointManager]::SecurityProtocol = "tls12, tls11, tls"


# first let's get the execution URL


[xml]$workflowXML = Invoke-RestMethod -Method Get -Credential $credential -Uri "$WFAserver/filters" -body @{ name = $workflowToExecute; }

 

 

 

Error what I am getting is :- -----

 

 

Invoke-RestMethod : The request was aborted: Could not create SSL/TLS secure channel.
At line:1 char:21
+ [xml]$workflowXML = Invoke-RestMethod -Method Get -Credential $credential -Uri " ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

Public