Delete a case from the Portal


I would Like to implement a scenario where a User is able to delete a case from the Portal.

I would like to use API to delete a case.
From the List of BPM Api's, There is a example as http://../API/bpm/case/ .

Now its mentioned that the Method is Delete. I assume that we need to change the action type of a button to Delete.

But What do I pass to the data sent on click . Do i send the API as data with correct case number.

Would a user have permission to execute the function ?

Any other way to implement such a scenario ?

2 answers

This one is the BEST answer!

Hi guys,

I tried it last week and that's not a documentation error.

You have to call the DELETE method on URL : http://[[BONITA_SERVER]]/bonita/API/bpm/case

The payload you send is a table containing a list of cases ids to delete. For example : ["1001","3001"]

Cheers :)


Submitted by Dibyajit.Roy on Mon, 02/27/2017 - 13:44

Thanks for your response.
I tried but I am getting a 403 forbidden error.

Any suggestions

Submitted by p.clainchard on Mon, 02/27/2017 - 13:46

Using 7.4 ?
Do you have the X-Bonita-API-Token ?
see :

Submitted by Dibyajit.Roy on Mon, 02/27/2017 - 13:53

Below is the Request Header. I dont see any Response header.
Request URL:http://localhost:8080/bonita/API/bpm/27006
Request Method:DELETE
Status Code:403 Forbidden
Remote Address:[::1]:8080
Response Headers
view source
Date:Mon, 27 Feb 2017 12:49:07 GMT
Request Headers
view source
Accept:application/json, text/plain, /
Accept-Encoding:gzip, deflate, sdch, br
Cookie:JSESSIONID=9B49BB1F76D323974B33E69876342BA1; bonita.tenant=1; X-Bonita-API-Token=aefbcf3a-f6d8-43da-be30-0a7bc2d305b0; BOS_Locale=en
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36

Also I checked, csrf is disabled .

Submitted by Dibyajit.Roy on Mon, 02/27/2017 - 14:10

Could you describe the Process that you had followed in your scope.

I had taken a Blank page, added a Button, changes the Method type to Delete and hard coded the url to call as http://localhost:8080/bonita/API/bpm/27006 .
Now I added the page to the Portal resource. Added the page to Application menu and launched the page.
Upon clicking , i am getting the Error.
Am I following the Right Process here ?

Submitted by Dibyajit.Roy on Mon, 02/27/2017 - 14:11

Sorry I Missed your First Question.

I am using 7.3.1 subscription .

Submitted by p.clainchard on Mon, 02/27/2017 - 14:30

Ok I just checked :)

You are calling "http://localhost:8080/bonita/API/bpm/27006" and not "http://localhost:8080/bonita/API/bpm/case" so the 403 Forbidden error occurs because the Delete method doesn't exist for "API/bpm/[[CaseId]]"

What I can see is that "http://localhost:8080/bonita/API/bpm/case" needs a payload (a content to send) containing the ids of cases to delete.

I can do it using SoapUI, but it is not possible with the UI designer DELETE action (if you select POST action you can see an additional field)

One other way to do it, is to record the id of the case you want to delete using the contract.
And then call a script to delete the case with the java API :

  • add a Groovy script
  • apiAccessor.processAPI.deleteProcessInstance(Long.parseLong(
Submitted by Dibyajit.Roy on Mon, 02/27/2017 - 14:34

Thanks for your Feedback.
The Second method sounds good. I am planning an automatic task and could execute the Script there.
I am not familiar with SOAP UI .

I am planning a complete Process to delete Both Case as well as BDM records corresponding to that case.
Also What do you recommend for deleting records from the Database.
Should I search Records with Case id or Persistence Id ?



Interesting - the documentation isn't up to date...I would report this as a bug.

I would assume the correct text should be something like:

Delete a case

URL /API/bpm/case/:caseId
Method: DELETE
Success Response Code: 200


PS: As this reply answers your question, please mark as resolved by ticking the tick mark on the left of this reply.