I am trying to delete cases in PM but I am not able to using the API
http://wiki.processmaker.com/3.1/REST_API_Cases#Delete_Case:DELETE.2Fcases.2F.7Bapp_uid.7D
I have tried this API but it gives me an error like:
[GuzzleHttp\Exception\ClientException]
Client error: `DELETE http://processmaker.app:32768/api/1.0/workflow/cases/50492041658e1dfca544ad3002222462` resulted in a `400 Bad Request` response:
{"error":{"code":400,"message":"Bad Request: You can't delete the case because it's not in Draft status and was already (truncated...)
Yes, I even tried cancelling the case but still the same error
The error you are receiving is because you cannot delete a case once it has left the status of DRAFT. That means, once a case is submitted to the next task, it is considered in the status of TODO.
So, once a case has transitioned to the status of TODO, you may only Cancel a case, not delete it.
You can find more information relating to that here: http://wiki.processmaker.com/3.1/user_guide#Cancel
Don't forget to make sure that the user you are making the rest api call as has the right permissions to be able to cancel/delete the case as well.
To cancel a case through the rest api, take a look at this link: http://wiki.processmaker.com/3.1/REST_API_Cases#Cancel_Case:PUT.2Fcases.2F.7Bapp_uid.7D.2Fcancel
I hope that helps!