Active IQ Unified Manager Discussions

Calling a WFA Workflow Using Rest

A_Campbell
12,242 Views

Is anyone familiar with how to specify user input when calling WFA via rest? Here's how I'm making the call:

 

https://wfaServer/rest/workflows/workflowID/jobs?input1=x&input2=y&input3=z

 

 

 

Here's the error I'm getting:

 

<data contentType="text/plain" contentLength="47"><![CDATA[No job input specified. Must specify user input]]></data>

 

 

 

Am I missing something with syntax on my http link?

 

 

 

Thanks

1 ACCEPTED SOLUTION

sinhaa
12,152 Views

@A_Campbell

 

Okay. 

 

You need WFA 4.1 or above for this. Doing this needs a new feature called 'Custom Rest end points' which is only present in the mentioned WFA version.

 

 

1. Open your workflow for editing. You'll see the last 'tab' is called 'Advanced'. Go to that tab.

2. You see it has fields 'Custom URI path for workflow' and HTTP method type drop-down selection.

 

3. Assuming your workflow have only 2 user-inputs and values as $Input1=x and $Input2=y.

 

4. Provide the Custom URI path as: /{Input1}/{Input2}/myworkflow

5. Select the HTTP method type : DELETE

 

Save it.

 

Now you can execute this workflow using some REST client:

 

 

URL:  https://wfaServer/rest/x/y/myworkflow/jobs

Method: DELETE

 

 

Now NO input body is required. This is expected as method DELETE is designed not to need a body. The inputs are provided in the URL itself.

 

If you want to have Input values as $Input1=x1 and $Input2=y1 the have the URL as:  https://wfaServer/rest/x1/y1/myworkflow/jobs

 

You are Done!!

 

sinhaa

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

View solution in original post

10 REPLIES 10

sinhaa
12,133 Views

@A_Campbell

 

I would suggest to see the REST API docs available on your WFA server at: https://WFAserver/rest/docs/

 

 

 

You can execute a workflow via REST APIs using the below:

 

URL:

https://wfaServer/rest/workflows/workflowUUID/jobs

 

Method: POST

 

Body in XML: 

 

<?xml version="1.0"?>
<workflowInput>
<userInputValues>
<userInputEntry key="Input1" value="x"></userInputEntry>

<userInputEntry key="Input2" value="y"></userInputEntry>
</userInputValues>
</workflowInput>

 

Creating an Input-Body can a time-taking error prone task especially if your workflow involves complex User-Input types like Query-Multi Select, or Tables or Password. I would suggest to use this post to get it within seconds and 0 errors. How to generate the User-Input XML Body for executing workflows via REST APIs: The Solution

 

WFA4.1 supports JSON body too. See the REST Docs for the format etc. The above post is not designed for JSON. I'll do it as soon as I can.

 

 

--------------------

 

But looking at your attempt to execute workflow providing Input values in URL, is this what you really want? Do you want to provide all user-inputs in the URL itself and NO Input body?

 

This too can be done. I can tel how to if you would want to know.

 

sinhaa

 

 

 

 

 

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

A_Campbell
12,103 Views

@sinhaa

 

Thanks for the information. Yes, I'd like to add the user input in the URL for the example I'm working on now since we just have a small number of values. If you are able to provide some information on how to do it this way, it would be appreciated. Thanks

sinhaa
12,153 Views

@A_Campbell

 

Okay. 

 

You need WFA 4.1 or above for this. Doing this needs a new feature called 'Custom Rest end points' which is only present in the mentioned WFA version.

 

 

1. Open your workflow for editing. You'll see the last 'tab' is called 'Advanced'. Go to that tab.

2. You see it has fields 'Custom URI path for workflow' and HTTP method type drop-down selection.

 

3. Assuming your workflow have only 2 user-inputs and values as $Input1=x and $Input2=y.

 

4. Provide the Custom URI path as: /{Input1}/{Input2}/myworkflow

5. Select the HTTP method type : DELETE

 

Save it.

 

Now you can execute this workflow using some REST client:

 

 

URL:  https://wfaServer/rest/x/y/myworkflow/jobs

Method: DELETE

 

 

Now NO input body is required. This is expected as method DELETE is designed not to need a body. The inputs are provided in the URL itself.

 

If you want to have Input values as $Input1=x1 and $Input2=y1 the have the URL as:  https://wfaServer/rest/x1/y1/myworkflow/jobs

 

You are Done!!

 

sinhaa

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

A_Campbell
12,074 Views

@sinhaa

 

Excellent, I appreciate the information!

A_Campbell
11,939 Views

@sinhaa

 

I'm getting an 'HTTP 400 Bad Request' error when I try to execute the workflow by specifying input in the URL.

Here's a screenshot of my custom URI path

uriPath.jpg

 

 

Here's the URL I'm using for execution:

 

https://wfaServer/rest/Test/5/App1/CON/California/Adam/Create_TDW_Share_Adam_SnapTransfer_confirm_rest/jobs

 

Am I specifying anything wrong that you can see? Is there a place where I should be specifying the userID and password that has access to the WFA workflow?

 

 

Thanks

sinhaa
11,896 Views

@A_Campbell

 

 

Am I specifying anything wrong that you can see? Is there a place where I should be specifying the userID and password that has access to the WFA workflow?

-----

 

From what I see, you are not familier with using your rest client. You are getting this 400 Bad request, because you are calling the url on method GET and not DELETE as you should be. Where to specify username/password depends on your rest-client, they all have place provided.

 

You can use Chrome ARC plugin for chrome browser or Smart Bear SOAP Ui client. You can write a code in any language as well.

 

sinhaa

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

A_Campbell
11,883 Views

@sinhaa

 

Thanks for the information. Yes, this is new material for me. I'm going to research the DELETE method and will post my findings once I get the rest call to complete successfully

SHYAMVOLVO
10,473 Views

HI Sinhaa, 

you have been excillent by providing answer in many post. 

 

I pretty new in REST API calling for WFA . 

In out environment we ahve created a FLOW which we would like to call using REST API. 

but I don't know how and what custom URI path we need specified to call it. Could you please hep me to solve it. 

 

we have a FLOW as below where we need to select some value from the drop down list.

 

Capture.JPG

 

 

 

Now  how should I access this FLOW using REST  API ?

what is value I need to put the custom URI path ?

 

Capture1.JPG

 

 

 

 

And How can I get the below return value from the  WorkFLow  ?

 

Capture2.JPG

 

 

 

Waiting for your valuable input here.

 

Thanks

Shyam

 

SuperMegaGreat
8,488 Views

I made a post that asked about how to go about calling via REST because this thread seemed sparse.

 

shorty after asking for help, i figured out what i was doing wrong.

https://community.netapp.com/t5/OnCommand-Storage-Management-Software-Discussions/New-to-REST-and-WFA-4-1-issues-with-calling-workflows-with-POST-or-D...

 

Please note, this does NOT solve a move LUN with in VOLUME problem.  I still have that one.  This is only my musings on using rest via CURL successfully with out using the fancy DELETE thing.

SuperMegaGreat
10,599 Views

How did this turn out?

 

I'm also experiencing a plethora of problems and am just starting out.

 

Public