Camunda REST API 7.2.0-alpha4: How to Create a Process Definition and Then Start a Process when Deployed?

1,739 views
Skip to first unread message

fermev...@gmail.com

unread,
Sep 11, 2014, 8:14:16 AM9/11/14
to camunda-...@googlegroups.com
Hi,

I'm reading the REST API but I'm not able to find a way to create a Process Definition and then Start the Process, once the process is deployed.

Thanks.

Christian Lipphardt

unread,
Sep 11, 2014, 9:14:59 AM9/11/14
to camunda-...@googlegroups.com
Hi,

You should be able to query the deployed process-definition by sending a GET request to http://localhost:8080/engine-rest/process-definition, which returns all deployed process-definitions for the default process engine.
Then you can start a process using a POST request to http://localhost:8080/engine-rest/process-definition/{id} where {id} is the id of the process definition retrieved through the previous GET request.
You can also start a process using the key of the process definition (usually the id part of the process element inside the bpmn.xml) by issuing a POST to http://localhost:8080/engine-rest/process-definition/key/{key} .
See http://docs.camunda.org/latest/api-references/rest/#process-definition-start-process-instance for more information on how to attach variables at process start etc.

Cheers,
Christian

--
You received this message because you are subscribed to the Google Groups "camunda BPM users" group.
To unsubscribe from this group and stop receiving emails from it, 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/be93f0c0-cf2a-463b-b42f-39185533d1f9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

signature.asc

fermev...@gmail.com

unread,
Sep 11, 2014, 9:46:00 AM9/11/14
to camunda-...@googlegroups.com
Hi thanks for the answer. The problem is that after the deployment through: http://localhost:8080/engine-rest/deployment/create, calling the deployment API (http://localhost:8080/engine-rest/deployment) I get this:

[
{
"links": [],
"id": "68975508-381e-11e4-9385-a6024ef8be8f",
"name": "test",
"deploymentTime": "2014-09-09T12:39:58"
},
{
"links": [],
"id": "750cb96a-381e-11e4-9385-a6024ef8be8f",
"name": "test",
"deploymentTime": "2014-09-09T12:40:19"
}
]

but calling the process definition API (http://localhost:8080/engine-rest/process-definition/) I get an empty response.

Christian Lipphardt

unread,
Sep 11, 2014, 10:26:36 AM9/11/14
to camunda-...@googlegroups.com
Hi,

Do you get anything when executing GET /deployment/{id}/resources
Do you get any logging output inside the application server’s log when deploying deployments through http://localhost:8080/engine-rest/deployment/create ?

Cheers,
Christian

--
You received this message because you are subscribed to the Google Groups "camunda BPM users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to camunda-bpm-us...@googlegroups.com.
To post to this group, send email to camunda-...@googlegroups.com.
signature.asc

fermev...@gmail.com

unread,
Sep 11, 2014, 11:06:54 AM9/11/14
to camunda-...@googlegroups.com
The output I get is something like this, and all seems correct:

Sep 09, 2014 4:15:44 PM org.camunda.bpm.engine.impl.bpmn.deployer.BpmnDeployer deploy
INFO: Processing resource New Process.bpmn.xml

Using GET /deployment/{id}/resources with the ID I get back from the deployment API, I have:

[
{
"id": "8d6d6efd-383c-11e4-9385-a6024ef8be8f",
"name": "New Process.bpmn.xml",
"deploymentId": "8d6d6efc-383c-11e4-9385-a6024ef8be8f"
}
]

Christian Lipphardt

unread,
Sep 11, 2014, 11:18:25 AM9/11/14
to camunda-...@googlegroups.com
Hi,

Please rename the process to either *.bpmn20.xml or just *.bpmn.
The bpmn parser of the engine does not recognize the suffix *.bpmn.xml.

Cheers,
Christian
> --
> You received this message because you are subscribed to the Google Groups "camunda BPM users" group.
> To unsubscribe from this group and stop receiving emails from it, 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/a47bbc74-90fb-4550-9519-737f33fe09f5%40googlegroups.com.
signature.asc

fermev...@gmail.com

unread,
Sep 11, 2014, 12:44:10 PM9/11/14
to camunda-...@googlegroups.com
The same behaviour also after changing name. I also drew a model with the camunda modeler and tried to deploy it, but nothing change. Referring to the database the deployment API populate the ACT_GE_BYTEARRAY and the ACT_RE_DEPLOYMENT (I'm reporting this in case it can be of any help).

Thanks.

Christian Lipphardt

unread,
Sep 11, 2014, 4:25:47 PM9/11/14
to camunda-...@googlegroups.com
Hi,

Could you please post the xml of your process?
Did you forget to mark your process as executable? See the isExecutable attribute inside the process element here: http://docs.camunda.org/latest/guides/user-guide/#process-engine-scripting-use-script-tasks .

Cheers,
Christian
Am 11.09.2014 um 18:44 schrieb fermev...@gmail.com:

> The same behaviour also after changing name. I also drew a model with the camunda modeler and tried to deploy it, but nothing change. Referring to the database the deployment API populate the ACT_GE_BYTEARRAY and the ACT_RE_DEPLOYMENT (I'm reporting this in case it can be of any help).
>
> Thanks.
>
> --
> You received this message because you are subscribed to the Google Groups "camunda BPM users" group.
> To unsubscribe from this group and stop receiving emails from it, 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/ce77da34-b4d5-42b2-ab99-d0ae823a5b7e%40googlegroups.com.
signature.asc

fermev...@gmail.com

unread,
Sep 12, 2014, 3:49:30 AM9/12/14
to camunda-...@googlegroups.com
Hi,

thanks, this was one problem (sorry for that :(). The second one is that the ID returned by the Deplyment/create API is different the one used inside the ACT_RE_PROCDEF table. The second one seems to use also the Business Key.

Deplyment/create API ID: 37f72320-385b-11e4-8cbc-ce02e9ad4508
ACT_RE_PROCDEF ID: Process_2:1:37fbde12-385b-11e4-8cbc-ce02e9ad4508

Maybe it would be better to have the actual ID. For now I'm generating from application side the ACT_RE_PROCDEF ID. It's simple since I have one version for every diagram.

Reply all
Reply to author
Forward
0 new messages