Hello
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 ?
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
regards
Seán
PS: As this reply answers your question, please mark as resolved by ticking the tick mark on the left of this reply.
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
Hi
Thanks for your response.
I tried but I am getting a 403 forbidden error.
Any suggestions
Thanks
Hello
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
Content-Length:0
Date:Mon, 27 Feb 2017 12:49:07 GMT
Server:Apache-Coyote/1.1
Request Headers
view source
Accept:application/json, text/plain, /
Accept-Encoding:gzip, deflate, sdch, br
Accept-Language:en-US,en;q=0.8
Connection:keep-alive
Cookie:JSESSIONID=9B49BB1F76D323974B33E69876342BA1; bonita.tenant=1; X-Bonita-API-Token=aefbcf3a-f6d8-43da-be30-0a7bc2d305b0; BOS_Locale=en
Host:localhost:8080
Origin:http://localhost:8080
Referer:http://localhost:8080/bonita/portal/resource/app/renewalProcess/testPage/content/
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 .
Hi
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 ?
Sorry I Missed your First Question.
I am using 7.3.1 subscription .
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(contract.id))
Hello
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 ?
Thanks