Retrieves an Activity Instance (Tree) for a given process instance by id.

Method

GET /process-instance/{id}/activity-instances

Parameters

Path Parameters

Name Description
id The id of the process instance for which the activity instance should be retrieved.

Result

A JSON object corresponding to the Activity Instance tree of the given process instance.

The properties of an activity instance are as follows:

Name Value Description
id String The id of the activity instance.
activityId String The id of the activity.
activityName String The name of the activity.
activityType String The type of activity (corresponds to the XML element name in the BPMN 2.0, e.g., 'userTask').
processInstanceId String The id of the process instance this activity instance is part of.
processDefinitionId String The id of the process definition.
childActivityInstances List of activityInstance A list of child activity instances.
childTransitionInstances List of transitionInstance A list of child transition instances. A transition instance represents an execution waiting in an asynchronous continuation.
executionIds List of String A list of execution ids.

The properties of a transition instance are as follows:

Name Value Description
id String The id of the transition instance.
activityId String The id of the activity that this instance enters (asyncBefore job) or leaves (asyncAfter job)
activityName String The name of the activity that this instance enters (asyncBefore job) or leaves (asyncAfter job)
activityType String The type of the activity that this instance enters (asyncBefore job) or leaves (asyncAfter job). Corresponds to the XML element name in the BPMN 2.0, e.g., 'userTask'.
processInstanceId String The id of the process instance.
processDefinitionId String The id of the process definition.
executionId List of String A list of execution ids.

Response Codes

Code Media type Description
200 application/json Request successful.
404 application/json Process instance with given id does not exist. See the Introduction for the error response format.

Example

Request

GET /process-instance/aProcessInstanceId/activity-instances

Response

  1. {
  2. "id": "8f72bc9f-d505-11e2-bafa-3c970e140ef1",
  3. "parentActivityInstanceId": null,
  4. "activityId": "executionProcess:1:8ef5c393-d505-11e2-bafa-3c970e140ef1",
  5. "processInstanceId": "8f72bc9f-d505-11e2-bafa-3c970e140ef1",
  6. "processDefinitionId": "executionProcess:1:8ef5c393-d505-11e2-bafa-3c970e140ef1",
  7. "childActivityInstances": [
  8. {
  9. "id": "SubProcess_1:8f72bca4-d505-11e2-bafa-3c970e140ef1",
  10. "parentActivityInstanceId": "8f72bc9f-d505-11e2-bafa-3c970e140ef1",
  11. "activityId": "SubProcess_1",
  12. "activityType": "subProcess",
  13. "processInstanceId": "8f72bc9f-d505-11e2-bafa-3c970e140ef1",
  14. "processDefinitionId": "executionProcess:1:8ef5c393-d505-11e2-bafa-3c970e140ef1",
  15. "childActivityInstances": [],
  16. "childTransitionInstances": [
  17. {
  18. "id": "8f72bca9-d505-11e2-bafa-3c970e140ef1",
  19. "parentActivityInstanceId": "SubProcess_1:8f72bca4-d505-11e2-bafa-3c970e140ef1",
  20. "processInstanceId": "8f72bc9f-d505-11e2-bafa-3c970e140ef1",
  21. "processDefinitionId": "executionProcess:1:8ef5c393-d505-11e2-bafa-3c970e140ef1",
  22. "activityId": "ServiceTask_1",
  23. "executionId": "8f72bca9-d505-11e2-bafa-3c970e140ef1"
  24. },
  25. {
  26. "id": "8f72bcaa-d505-11e2-bafa-3c970e140ef1",
  27. "parentActivityInstanceId": "SubProcess_1:8f72bca4-d505-11e2-bafa-3c970e140ef1",
  28. "processInstanceId": "8f72bc9f-d505-11e2-bafa-3c970e140ef1",
  29. "processDefinitionId": "executionProcess:1:8ef5c393-d505-11e2-bafa-3c970e140ef1",
  30. "activityId": "ServiceTask_2",
  31. "executionId": "8f72bcaa-d505-11e2-bafa-3c970e140ef1"
  32. }
  33. ],
  34. "executionIds": [
  35. "8f72bc9f-d505-11e2-bafa-3c970e140ef1"
  36. ]
  37. }
  38. ],
  39. "childTransitionInstances": [],
  40. "executionIds": [
  41. "8f72bc9f-d505-11e2-bafa-3c970e140ef1"
  42. ]
  43. }

原文: https://docs.camunda.org/manual/7.9/reference/rest/process-instance/get-activity-instances/