是否有 API 显示 Camunda 端的用户任务历史记录?

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

我有一个 Camunda 流程,这个流程中有 2-3 个用户任务。我想在完成这些任务后查看他们的历史记录。有几种方法,但我只想通过 rest-api.

获取标签和输入的值

我不能直接用rest-api.

以下方法returns变量与processInstanceId。

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

但我需要调用另一个 rest-api 来获取标签。 GET /process-definition/{id}/xml 与此 api.

为此开了其他的话题,但并不完全符合我的要求。 similar question

我认为你是对的,你需要2个步骤。我会合并以下请求:

首先获取所有用户任务:

GET /history/task - 参见 API Reference

根据其结果数组,您需要 idname(即标签):

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

现在您可以获取每个 UserTask 的变量,例如

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

https://docs.camunda.org/manual/7.16/reference/rest/history/variable-instance/post-variable-instance-query/

returns 过程变量的名称(标签)和值

[
  {
    "id": "someId",
    "name": "someVariable",
    "type": "Integer",
    "variableType": "integer",
    "value": 5,
    "valueInfo": {},
    "processDefinitionKey": "aProcessDefinitionKey",
    "processDefinitionId": "aProcessDefinitionId",
    "processInstanceId": "aProcInstId",
    "executionId": "aExecutionId",
    "activityInstanceId": "aActivityInstId",
    "caseDefinitionKey": null,
    "caseDefinitionId": null,
    "caseInstanceId": null,
    "caseExecutionId": null,
    "taskId": null,
    "tenantId": null,
    "errorMessage": null,
    "state": "CREATED",
    "createTime":"2017-02-10T14:33:19.000+0200",
    "removalTime": "2018-02-10T14:33:19.000+0200",
    "rootProcessInstanceId": "aRootProcessInstanceId"
  }
]