Getting ProcessInstances/Task with variables in a single request

Hello,

Recently I started using Camunda Rest Api in a Spring Boot container and I need to get all opened process instances or task with their variables. I could make a first request “/process-instance” and next make a “/variable-instance” for each process instance or a single request passing a list of processInstances using processInstanceIdIn parameter.

This works fine, but is harder an less efficient than a single request that returns all informations.

There is other way to do this using Camunda rest api?

There is some issue on the Camunda roadmap about this subject?

Thank you,

Denis.

I had the same problem some times.
But everytime I had slightly different requirements for variables and task to show up in the process list, so I think that an official REST API cannot be exhaustive with a single call, but can be quite useful with composite calls.

It is really slow though.

When you have this kind of requirement, it could be better write your own rest call, confined in your application. This rest call can use the java API’s to query camunda. This should have a better performance because you’ll avoid the time of different calls and the overhead.

An even better performance (not a best practice though) is to query directly the camunda database. It can be very fast when joining exactly what you need luckily with one or two sql queries.

If you are stuck with official REST, I suggest to minimize details in a list view, and to expose details only in a per process view.

1 Like

Hi Mizar01,

Creating my own api endpoint using Camunda Java API is an option. Using SQL Query approach has a better performance but create a bad coupling.

Thanks for your help!

I forgot to mention there is a native query support for camunda queries, that leverages you from db internals and let you use only model entities (e.g. Using jpa directly). It can be useful.

2 Likes