Deleting histroy with API delete-historic-query-based

Hi,

We use the API to clear history. We noticed that nothing was deleted in the database, and those instances are still available in Cockpit. Additionally, if we repeat the same request, the batch has the same number of instances to delete.

curl --location --request POST ‘https://bpm.zg.iskon.hr/engine-rest/process-instance/delete-historic-query-based’ \

–data-raw '{

“historicProcessInstanceQuery”: {

"finishedBefore": "2020-10-01T05:24:37.765+0200"

},

“deleteReason” : “Instance starije od 300 dana”,

“skipCustomListeners” : true,

“skipSubprocesses” : true

}’

Hi @josips
Welcome to the forum,
Can you give some details of what version of Camunda you’re using?
Is there a reason why you’re not using the automatic history cleanup mechanism?

Hi @josips,

This API call is supposed to delete running process instances only based on historic query so history is not supposed to get cleaned up using this call.

You can read about history clean up in below link

https://docs.camunda.org/manual/7.15/user-guide/process-engine/history/#history-cleanup

Thank you for your answers. I use wrong method. Correct method was

curl --location --request POST ‘http://bpm-test.zg.iskon.hr:8080/engine-rest/history/process-instance/delete’ \

–header ‘Content-Type: application/json’ \

–data-raw '{

“deleteReason” : “Older from 300d and finiched”,

“historicProcessInstanceQuery”: {

"finishedBefore": "2020-08-01T11:44:17.000+0200"

}

}’

1 Like

Yes, I can. We are using version v7.14.3-ee.

And we are using automatic history cleanup mechanism but we notice that cleanup didn’t clean old instances. We changed the TTL afterwards, more specifically we reduced the TTL, but the cleanup did not delete the completed instances.