kibana/docs/api/synthetics/monitors/delete-monitor-api.asciidoc
Shahzad d25a2b442a
[Synthetics] Refactor bulk delete monitor and params routes !! (#195420)
## Summary

Refactor bulk delete monitor and params routes !! 

We need to remove usage for body from DELETE route.

### Params

Params can be bulk delete now with POST request to
`/params/_bulk_delete` endpoint

### Monitors
Monitors can be bulk delete now with POST request to
`/monitors/_bulk_delete` endpoint
2024-11-07 10:51:56 +01:00

83 lines
No EOL
2.2 KiB
Text

[[delete-monitors-api]]
== Delete Monitors API
++++
<titleabbrev>Delete monitors</titleabbrev>
++++
Deletes one or more monitors from the Synthetics app.
=== {api-request-title}
`DELETE <kibana host>:<port>/api/synthetics/monitors/<config_id>`
`DELETE <kibana host>:<port>/s/<space_id>/api/synthetics/monitors/<config_id>`
=== {api-prereq-title}
You must have `all` privileges for the *Synthetics* feature in the *{observability}* section of the
<<kibana-feature-privileges,{kib} feature privileges>>.
[[delete-monitor-api-path-params]]
=== {api-path-parms-title}
`config_id`::
(Required, string) The ID of the monitor that you want to delete.
Here is an example of a DELETE request to delete a monitor by ID:
[source,sh]
--------------------------------------------------
DELETE /api/synthetics/monitors/monitor1-id
--------------------------------------------------
==== Bulk Delete Monitors
You can delete multiple monitors by sending a list of config ids to a POST request to the `/api/synthetics/monitors/_bulk_delete` endpoint.
[[monitors-delete-request-body]]
==== Request Body
The request body should contain an array of monitors IDs that you want to delete.
`ids`::
(Required, array of strings) An array of monitor IDs to delete.
Here is an example of a POST request to delete a list of monitors by ID:
[source,sh]
--------------------------------------------------
POST /api/synthetics/monitors/_bulk_delete
{
"ids": [
"monitor1-id",
"monitor2-id"
]
}
--------------------------------------------------
[[monitors-delete-response-example]]
==== Response Example
The API response includes information about the deleted monitors, where each entry in the response array contains the following attributes:
- `id` (string): The unique identifier of the deleted monitor.
- `deleted` (boolean): Indicates whether the monitor was successfully deleted (`true` if deleted, `false` if not).
Here's an example response for deleting multiple monitors:
[source,sh]
--------------------------------------------------
[
{
"id": "monitor1-id",
"deleted": true
},
{
"id": "monitor2-id",
"deleted": true
}
]
--------------------------------------------------