Calling Camunda process using REST API

1,397 views
Skip to first unread message

sundar....@gmail.com

unread,
Sep 18, 2015, 5:44:18 PM9/18/15
to camunda BPM users
Hello,

I have created a process and deployed in the server, all I need to know is there any way I could able to kick off the process through the REST API, for instance my process name select-application, which accepts one parameter application name, how I can start this process using REST, I can do this via Camunda web page by calling start process, but I wanted to create the process through REST call.

Thanks in advance.

Regards,

Sudhakar S

webcyberrob

unread,
Sep 19, 2015, 4:14:08 AM9/19/15
to camunda BPM users
Hi Sudhakar,

Yes there is a REST API you can use to start a process instance. Follow the link to the relevant example and documentation below.

[1] http://docs.camunda.org/manual/7.3/api-references/rest/#process-definition-start-process-instance

regards

Rob

Sudhakar Sundar

unread,
Sep 19, 2015, 11:27:37 AM9/19/15
to camunda BPM users
Hello Rob,

Thanks for your response, Iam quiet new to the Camunda tool, Iam trying to evaluate this product to integrate with my application which will invoke the BPM process in the Camunda tool, I created a simple process which accepts one string parameter in the Start of the process,


my process definition(http://localhost:8080/engine-rest/process-definition/key/sud-approve-loan) is
{"id":"sud-approve-loan:22:fee736d9-5e23-11e5-868b-28d2441d2503","key":"sud-approve-loan","category":"http://activiti.org/bpmn","description":null,"name":"Sud Loan Approval","version":22,"resource":"sud-loan-approval.bpmn","deploymentId":"fee1b896-5e23-11e5-868b-28d2441d2503","diagram":"sud-loan-approval.png","suspended":false}

and the form variables (http://localhost:8080/engine-rest/process-definition/key/sud-approve-loan/form-variables) is
{"approved":{"type":"String","value":null,"valueInfo":{}}}

All Iam trying is to invoke the process through REST API(http://localhost:8080/engine-rest/process-definition/key/sud-approve-loan/start) and the body is
{"variables":
{"approved" : {"value" : "CBUS", "type": "String"}},
"businessKey" : "123"
}

Iam getting the below response
<html><head><title>Apache Tomcat/7.0.62 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 415 - Cannot consume content type</h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u>Cannot consume content type</u></p><p><b>description</b> <u>The server refused this request because the request entity is in a format not supported by the requested resource for the requested method.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/7.0.62</h3></body></html>

I would like to know if Iam missing something here, my BPMN start even is below
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://activiti.org/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="_ItPmEF10EeW0nc9vDM98aw" exporter="camunda modeler" exporterVersion="2.7.0" targetNamespace="http://activiti.org/bpmn">
  <bpmn2:process id="sud-approve-loan" name="Sud Loan Approval" isExecutable="true">
    <bpmn2:startEvent id="StartEvent_1" name="Loan Request Received">
      <bpmn2:extensionElements>
        <camunda:formData>
          <camunda:formField id="approved" label="Enter Application name(GFP/CBUS/GEOLINK)" type="string"/>
        </camunda:formData>
      </bpmn2:extensionElements>
      <bpmn2:outgoing>SequenceFlow_17</bpmn2:outgoing>
    </bpmn2:startEvent>

Should I need to do something while creating a BPMN process to invoke through REST API, I tried with the sample load application example and customized that to my requirement.

Looking forward for a solution. Thanks.

Regards,

Sudhakar S

On Saturday, September 19, 2015 at 3:14:08 AM UTC-5, webcyberrob wrote:
Hi Sudhakar,
[p]g

Sudhakar Sundar

unread,
Sep 19, 2015, 7:55:57 PM9/19/15
to camunda-...@googlegroups.com
Hello Rob,

Nevermind, I got this issue resolved, I forgot to add the header in the request for json type which resolved this issue,

I like to take an opinion on designing a application.

I wanted to design a workflow for screen navigation, I will be hosting the camunda engine in a separate server and my application in another server, I like to know what is the best way to implement, I wanted to do a screen flow based upon the options the user provides in the screen. Can you please let me know how to achieve this in Camunda.

Thanks in advance.

Regards,

Sudhakar S

--
You received this message because you are subscribed to a topic in the Google Groups "camunda BPM users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/camunda-bpm-users/rQhxiy8cnGg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to camunda-bpm-us...@googlegroups.com.
To post to this group, send email to camunda-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/camunda-bpm-users/40307b0e-8bb5-40f3-a9f1-83203c022d67%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

webcyberrob

unread,
Sep 22, 2015, 4:15:26 AM9/22/15
to camunda BPM users
Hi Sudhakar

Sorry to take so long to followup on this...

In my personal opinion, I like to treat screen flow or page flow separately from process flow. However, lest assume that you do want to model screenflow using user tasks in a BPMN model. Bernd has previously published a pattern regarding this, a link included below;


As an alternate architecture, you could realise pageflow via say a Rich Internat App (eg Angular using its routes etc), or say via a Spring app (using Spring Webflow) Both of these approaches will readily work with Camunda. Hence in this style...

regards

Rob

Sudhakar Sundar

unread,
Sep 22, 2015, 9:34:42 AM9/22/15
to camunda-...@googlegroups.com

Hello Rob,

Thanks a lot for your suggestions, it looks much promising, I will take your advice and implement the solutiom.Thanks again

Sudhakar S

Reply all
Reply to author
Forward
0 new messages