How can I delete or cancel an open human task and running process instances?

Hi to everyone.

I want to delete or cancel some of my open human tasks and running process instances.
Does anyone know how can I do this?

Thank you
Steve

One way to do it is via the REST API - The process instance modification call can create and delete token from your process instance. You can use it to cancel currently active tokens on user tasks.

1 Like

Hi @Niall.

I want to delete all my running process instances so I think that my answer is included in (https://docs.camunda.org/manual/7.8/reference/rest/process-instance/delete/).
But I haven’t understood where I must write the delete request.
Could you please explain to me or by giving an example?

Thank you,
Steve

The REST call can be made using a client like Postman. To delete running instances try this example.

.

Hi @Niall.

Thanks for your hint. I downloaded the Postman client and I would need a bit more help in the beginning as it’s my first attempt.
When I run the app and select to create a basic request I see the following screenshot:

Once I click on x at the top right of the dialog box, I see the following one:

I select the method which in my case is the POST.
Once I click on Params tab I have to fill in the 3 fields (Key, Value, Description).
So, there, have I to add my request body like the marked one of the example to hit the send button and get my response?

For example: the first key must correspond to “deleteReason” and the first value to my personal reason? And the description?
What must I fill in the request url?

Sorry again for my many questions but it’s my first REST call.

Many thanks,
Steve

If you’re running Camunda locally then rest endpoint is going to be
http://localhost:8080/engine-rest/

all calls you make should follow that e.g. http://localhost:8080/engine-rest/process-instance/delete
In the headers section you need to add
ContentType -> Application/Json

Hi again @Niall.

So, I filled in the request url the http://localhost:8080/engine-rest/ since I run locally Camunda.
I added what you said in the Headers section.
My only question here concerns where I have to write my Request Body.
In the Body section the default selection is in form-data and I have to fill in the fields Key, Value and Description.
Could you explain to me please?

Thanks,
Steve

This should do it:

Hi again @Niall.

I sent my body delete request twice today but I received the following answer in Postman:

My request body with all the Ids of my running process instances is this one:

Have you got any idea about this? :confused:

Thanks,
Steve

The above quote will solve your problem. You’re rest call is simply calling the engine itself. It need to have the correct endpoint - in this case that end point is /process-instance/delete

1 Like

Hi @Nial.
Yes, you 're right.
I hadn’t written the ending process-instance/delete in the requested url.

Thank you very much for your hint :slightly_smiling_face:
Steve

@Nial, I would like to ask something additional about the deletion of running process definitions.

Where must I write my request in Postman? Have I to change something except for the endpoint in relation to the deletion of process instances?

I read this chapter on docs (https://docs.camunda.org/manual/7.8/reference/rest/process-definition/delete-process-definition/)

I want to delete 6 running process definitions (versions) for example.

Thanks,
Steve

Deleting the process definitions is pretty straight forward.
You just need to change the endpoint and the request body can be empty

Hi @Nial.
I found a similar topic in previous days here: How to completly remove a process definition
So, I deleted all my active deployments as I have been testing many times the code for my task forms and I wanted to clear all of them.

Thank you anyway, I appreciate your help. :slightly_smiling_face:

My regards,
Steve

Hi @Niall,

Does this REST call (https://docs.camunda.org/manual/7.8/reference/rest/process-instance/delete/) delete the process instance and all its tasks ?

Hi @carloborsoi,

Yes, it does. Do you see another behaviour?

Best regards,
Yana

Hi @Yana,

Thanks for your reply.

No, I did not see another behavior. I was in doubt because I did not found it in the documentation.