Is it possible to start several processes in one call (batch) in the REST API

Hi!

If I have a large number of business objects (same business key) that all should start the same process with the same variables, is it possible to call some batch endpoint in the REST API for that, or do I need to call the endpoint ( /process-definition/{id}/start) several times?

Best regards,
Steinar

@withrocks You need to model the process with Multi-instance embedded subprocess. It will create multiple instances for each business objects with same businesskey like below model.

You need to configure multi-instance properties like below:

<bpmn:subProcess id="SubProcess_1amaiqu" name="Multi Instance sub process for each business objects">
      <bpmn:incoming>SequenceFlow_142m3m0</bpmn:incoming>
      <bpmn:outgoing>SequenceFlow_13ak834</bpmn:outgoing>
      <bpmn:multiInstanceLoopCharacteristics camunda:collection="${businessEntityIdList}" camunda:elementVariable="businessEntityId" />
.....
</bpmn:subProcess>

So this way, for each business object will have subprocess and associated with the same businesskey.

To start the process instance, you can call any of the below start-process-instance api’s:

POST /process-definition/{id}/start

POST /process-definition/key/{key}/start (starts the latest version of the process definition which belongs to no tenant)

POST /process-definition/key/{key}/tenant-id/{tenant-id}/start (starts the latest version of the process definition for tenant)

no need to call several times. Calling above mentioned api once will do the job.

@aravindhrs - we have the same requirement . On a side note , do we have to select the async check box when we are creating so many process instances and if we do that do we need to make some settings on the job executor based on your experience .

Thanks for the response @aravindhrs

This is interesting, but I would prefer that this would be possible without having to write a workflow that supports this explicitly. I was just hoping for another endpoint that would take a list of business keys instead of just one to start several identical (except for the business key) processes.

A bit of background for clarification: We are building a generic laboratory information system that uses Camunda as a workflow engine. It’s generic in the sense that we don’t know beforehand what kind of workflows the user will want to define, but we want the users to be able to define workflows without too much knowledge of BPMN.

On request the system batch assigns selected business objects (usually samples in a laboratory) to a selected workflow. It will probably not be an issue to do this in several calls to the API, but it would be both cleaner and faster to do it in a batch.

I’m aware that we can probably do this easily if we go through the java API rather than the REST API, but since we are building the system in Python, we’re going for REST integration (for now at least).

Hi @withrocks,

this community extension offers another approach: https://github.com/camunda/camunda-bpm-custom-batch

Hope this helps, Ingo