Querry (with rest api) which end event (endingAcitvityId ) ended the process

While using Rest API, how can I find out, which end point was used to end the process.

In processes with multiple end events an end event used to end the process instance can (sometimes) quickly tell you, how the business process ended (requestConfirmed/requestDenied, orderSuccessfull/orderFailed etc.).

It can be found in the database and could be very useful to tell how the business process ended (without using variables etc.) yet in the rest api I can’t seem to find a way to get this info.

All i can find is the history/process-instance/get-process-instance/ call that provides start and end times (startTime and endTime) as well as the starting activity id (startActivityId). However there is no endingActivityId.

Is there any way that process instance endingAcitvityId can be retrieved via Rest API?

@Klavdij_Lapajne could you use: https://docs.camunda.org/manual/7.7/reference/rest/history/activity-instance/post-activity-instance-query/

and sort by date and activity type to get the last end event that occurred?

This might work. Will try it out … thanks.

Would definitely like to see this parameter added to history/process-instance/get-process-instance/ call. Since it already has a startActivityId it makes no sense to not have the ending one as well …

Just a guess, but given Call Activities/Sub-process chaining, the fact that you don’t “need” an end event (technically), and parallel tokens that means you could have multiple end events that occur at the same time?, the, how you determine the relevant “end event” maybe is something of a case by case determination?

The relevant end event (ending activity id) is already determined as it is written in the database. Try:

select p.proc_def_key_, p.start_time_, p.end_time_, p.start_act_id_, p.end_act_id_ from act_hi_procinst p;

p.end_act_id is the end event in question. Whether it is relevant to a specific case is another question, but I found it that many time it would come in handy.