Skip to main content


 

Symptoms

 


Not able to start a process using REST services
 

 

Diagnoses

 


We are trying to launch the process using REST by sending a post request like below. We are getting HTTP 202 back, and the process does not get kicked off. There is nothing specific in the log file (attached).

https://k2.denallix.com/K2Services/REST.svc/Process/Instances/StartInstance?synchronous=true
User-Agent: Fiddler
content-type: application/xml
Host: k2.denallix.com
Content-Length: 669
 

 

Resolution

We were able to start process instances using REST > POST with both SOAPUI and Fiddler Request Composer. The POST header below will be necessary:

Authorization: Basic or NTLM {encrypted token goes here}
Content-type: application/xml

The Request body should have the following (this example without datafield/xml input, please see the documentation for more information):

<?xml version="1.0" encoding="utf-8"?> <w:ProcessInstance xmlns:w="http://schemas.k2.com/worklist/d1" xmlns:p="http://schemas.k2.com/process/d1" ExpectedDuration="20" FullName="K2Project2Process" Folio="POSTCall" Priority="3"></w:ProcessInstance>

http://help.k2.com/onlinehelp/k2blackpearl/devref/4.6.9/default.htm_ProcessInstancesStartInstance.html?TocPath=Reference%20Information|Services%20Reference|K2%20Services%20(Workflow%20Runtime)|Process%20Service|_____2

 

 



 

Hi Tin,

 

I have provided the Authorization and content-type in the hearder, and I provided the Basic authentication with base64 encrypted token. But still failing with 401 error.

what method have you used to generate token?

 

Thanks

Kiran Kumar U


Hi,

I am having a similar issue, I can get my workflow to start in Fiddler with 'Automatic Authentication' enabled , but with my Ajax call to the rest service doesn't work at all. Any ideas would be great?

 

Fiddler Details

http://dlx/K2Services/REST.SVC/Process/Instances/StartInstance?piDataField=true

Header 

Content-type: application/xml
dataType: xml

Body

<w:ProcessInstance xmlns:w="http://schemas.k2.com/worklist/d1" xmlns:p="http://schemas.k2.com/process/d1" FullName="simonsimon" Folio="BOB">
<p:DataField Name="test">1</p:DataField>
</w:ProcessInstance>

 

Ajax Call Example

 

$.ajax
(
{
url: 'http://dlx/K2Services/REST.SVC/Process/Instances/StartInstance?piDataField=true',
type: 'POST',
data: '<?xml version="1.0" encoding="utf-8"?><w:ProcessInstance xmlns:w="http://schemas.k2.com/worklist/d1" xmlns:p="http://schemas.k2.com/process/d1" FullName="simonsimon" Folio="1234"><p:DataField Name="test">1</p:DataField></w:ProcessInstance>',
Contenttype: "application/xml",
dataType: "xml",
beforeSend: function (XMLHttpRequest) { $.support.cors = true; },
error: function (result, error, status) { $("p").html("Error: Workflow Not Started") },
success: function(result){$("p").html("Success: Workflow Started Via Rest Call & data field set")}

});


Reply