Subscribe
Accepted Solution

Calling a WFA Workflow Using Rest

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

Re: Calling a WFA Workflow Using Rest

@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.

Re: Calling a WFA Workflow Using Rest

@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

Re: Calling a WFA Workflow Using Rest

@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.

Re: Calling a WFA Workflow Using Rest

@sinhaa

 

Excellent, I appreciate the information!

Re: Calling a WFA Workflow Using Rest

@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

Re: Calling a WFA Workflow Using Rest

@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.

Re: Calling a WFA Workflow Using Rest

@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