Search code examples
springcamundacamunda-plugin

Is there an API that shows the user task histroy on the Camunda side?


I have a Camunda flow, there are 2-3 user tasks in this flow. I want to see their history after completing these tasks. There are a couple of methods, but I just want to get both the label and the entered value with rest-api.

I can't get them directly with rest-api.

The following method returns variables with the processInstanceId.

List<HistoricVariableInstance> instances = historyService.createHistoricVariableInstanceQuery()
.processInstanceId(processIntanceId)
.list();

but I need to call another rest-api to get the labels. GET /process-definition/{id}/xml with this api.

Other topics have been opened for this, but it does not meet exactly what I want. similar question


Solution

  • I think you are right, you need 2 steps. I would combine the following requests:

    First get all User Tasks:

    GET /history/task -see API Reference

    From its result Array you need the id and the name (which is the label):

    [{"id":"anId",
     ...
     "name":"aName",
     ...
     }]
    

    Now you can get the variables for each UserTask, like

    GET /history/variable-instance?taskIdIn=YourTaskId see API Reference