How to delete incidents with API(core-api-post /incident/batchDelete)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Please sign in to see details of an important advisory in our Customer Advisories area.

How to delete incidents with API(core-api-post /incident/batchDelete)

L1 Bithead

Hello,

 

I am sending a command like below on the API.

 


But it does not delete the incidents I want. It does not give an error.
How to use this correctly? I want to delete all indicents before a certain date (for example 01.01.2024).

 

Thanks.

3 REPLIES 3

L3 Networker

Hello,

 

In your payload, the incident id is passed as a filter, which is incorrect. Here is an example of the correct payload format,

 

!core-api-post uri=uri=`/incident/batchDelete` body=`{"ids":["260906"]}`

 

Additionally, the filter parameter accepts a query if you need to delete all incidents before a certain date. You can view the payload format on developer tools, by monitoring the request to delete an incident.

 

Please let me know if you have further questions.

 

Thanks,

Rahul

L1 Bithead

as an example, can you forward a query that will delete all incidents before 2024-01-01 00:00?

L1 Bithead

In addition, get error like this;

Reason
Error from Core REST API is : Script failed to run: Core REST APIs - Request Failed. Status code: 400. Body: {"StatusCode":400,"Status":"400 Bad Request","Cookies":[],"Body":"{\"id\":\"missing_request\",\"status\":400,\"title\":\"Bad request\",\"detail\":\"Request body is missing mandatory parts.\",\"error\":\"Missing required filter argument on batch request (7)\",\"encrypted\":false,\"multires\":null}\n","Bytes":
  • 564 Views
  • 3 replies
  • 0 Likes
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!