Historic Activity Instances / Process Instances

Hi,

We need to find all instances that have completed ; but we haven’t found how in your Camunda Platform 8.0 API.

Where can we find methods equivalent to the methods below from Camunda 7 ?

Get Historic Activity Instances :
https://docs.camunda.org/manual/7.8/reference/rest/history/activity-instance/get-activity-instance-query/

https://docs.camunda.org/manual/7.13/reference/rest/history/process-instance/get-process-instance-query/

We need finishedAfter, finished or similar parameter…

Thanks in advance!

Regards,
Olivier

Hi @olinic87, welcome to the forum! I think the API you are looking for is this one:

You can find more information about the search and filter options here.

Hi @nathan.loding , thanks for your answer

Indeed, we had seen this method and its filters, but we had not seen the subtlety that we could filter by date period:
https://docs.camunda.io/docs/apis-tools/operate-api/overview/#filter-dates
We will therefore test this and we will keep you informed of the results.

I have doubts that it meets our precise need: we will poll the API at regular intervals to retrieve all instances completed since the last API call. So we need to search for all instances completed after yyyy-MM-dd’T’HH:mm:ss. But by adding ||/h, we will potentially bring back the same occurrences several times. Otherwise you would have to make a call with ||/m every minute?
Isn’t there the equivalent of doing a finishedAfter search?

In other words, if we call the method with parameter
2022-03-17T11:50:25.729+0000||/h
will this bring back completed instances from 11:00 to 11:59, or will this bring back completed instances from 11:50 to 12:50? In the latter case, this meets the need :slight_smile:

Hi @olinic87 - we don’t support a range or “greater than/less than” query on dates yet. I have provided this feedback to the product team as we continue to improve the API experience in Camunda.

The date filter in Operate is ultimately just a pass through to Elasticsearch (as the data being queried is coming from Elasticsearch). ES supports some additional date math operators … I haven’t tried them with Operate yet, but I think they should work. For instance, you can do endDate: "2024-05-02T00:00:00.000+0000||+1h". If you try it, let me know if it works or not!