Access Process Instance History End Activity via REST API

We need to determine the ending activity for a completed process instance. I see that the database table ACT_HI_PROCINST has the column END_ACT_ID_. This field appears to contain the ID of the ending activity, which is what we need to access.

We are using the REST API to implement our application. However, it does not appear that the REST API provides access to this data item. This endpoint: GET /history/process-instance/{id}, appears to be the endpoint to use for accessing process instance history, but it does not return the ending activity. I see that it does return startActivityId, but not the end activity ID.

Am I missing something? Is the end activity for a completed process instance available via the REST API. If not, how do you suggest we gain access to this data?

We are currently using version 7.4.

Hey Stephen,

you can made a GET request on the /history/activity-instance resource
with the query parameters processInstanceId, finished,sortBy and sortOrder. So a example request can look like this:
GET /history/activity-instance?processInstanceId=procID&finished=true&sortBy=endTime&sortOrder=desc

This request returns a list of finished activities which belongs to a process instance with the id procID ordered by the endTime descending.

To get only one result you can also use the maxResults queryparameter and set them to 1.

See the documentation for this.

Best regards,
Chris

Thank you for the response. So then is it safe to assume that the most recent activity for a completed process instance will be the end event?

Hi,

we have a similar problem: We want to extract the id of the end event for each process instance in the history table. In Camunda BPM 7.5 there still exists a column END_ACT_ID in the table ACT_HI_PROCINST, but there is still no such field in the response of the GET call to /history/process-instance/{id}.

The suggested way from Zelldon does not work in Camunda BPM 7.5. There are no end events in ACT_HI_ACTINST although there are entries in the column END_ACT_ID of ended process instances in ACT_HI_PROCINST.

How can you get information about the end event a process instance ended in with Camunda BPM 7.5?
We’d like to use this information in a Cockpit plugin. Therefore an approach using the REST API would be great!

Thanks!

Cheers,
Kerstin

Hi Kerstin,

why do you think that there are no end events in the table ACT_HI_ACTINST?

If you want the END_ACT_ID as value in the response of the Get Single Process Instance method,
you can create a CAM ticket for that.

Best regards,

Chris

Hi Chris,

I just realized that there are end events in the table ACT_HI_ACTINST for process instances which were ended “manually”. There must be a bug in our demo data generator because it seems that there are no end events in the mentioned table for generated historic process instances…

Thanks for the hint with the CAM ticket! I will create one.

Cheers,
Kerstin

Hi Chris,

what is the appropriate way to create a CAM ticket (without having a JIRA account)? Can you create a ticket for having the END_ACT_ID in the response of the mentioned REST call? That would be great!

Thanks,
Kerstin

Hi Kerstin,

I created a CAM-Ticket for this.

Best regards,
Chris