kibana/docs/api/synthetics/monitors/find-monitors-api.asciidoc
Shahzad 29e8394c3d
[Synthetics] Monitor CRUD's public api's (#169928)
## Summary

Part of https://github.com/elastic/kibana/issues/169547

View docs at [Changed
pages](https://kibana_169928.docs-preview.app.elstc.co/diff)

Add monitor api public api 

### Testing

Make sure you have some monitors populated before testing this PR and
before switching to the branch

- [ ] Try editing already added monitors via API
- [ ] Test adding monitors via API, and then edit those via and
subsqeuently try editing via API the same monitor
- [ ] Test editing monitors via API
- [ ] Test deleting monitors via API
- [ ] Test getting monitors via API
- [ ] Testing private as well public locations

Basic workflow that i am interesting in testing is to make sure, you can
add/edit via both API and UI without any issues


Test each of HTTP/TCP/ICMP browser examples

<img width="1728" alt="image"
src="3575d93a-5f04-4c80-ac62-038643f466f8">

---------

Co-authored-by: Justin Kambic <jk@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Dominique Clarke <dominique.clarke@elastic.co>
2024-04-12 15:10:11 -04:00

126 lines
3.2 KiB
Text

[[find-monitors-api]]
== Find Monitors API
++++
<titleabbrev>Get List of Monitors API</titleabbrev>
++++
Get a list of monitors based on query parameters.
[[find-monitor-api-req]]
=== {api-request-title}
`GET <kibana host>:<port>/api/synthetics/monitors`
`GET <kibana host>:<port>/s/<space_id>/api/synthetics/monitors`
=== {api-prereq-title}
You must have `read` privileges for the *Synthetics* feature in the *{observability}* section of the
<<kibana-feature-privileges,{kib} feature privileges>>.
[[find-monitor-api-path-params]]
=== {api-path-parms-title}
`space_id`::
(Optional, string) An identifier for the space. If `space_id` is not provided in
the URL, the default space is used.
[[find-monitors-api-query-params]]
=== {api-query-parms-title}
`page`::
(optional, integer): Page number for paginated results.
`perPage`::
(optional, integer): Number of items per page.
`sortField`::
(optional, string): Field to sort the results by. Possible values: `name`, `createdAt`, `updatedAt`, `status`.
`sortOrder`::
(optional, string): Sort order (asc or desc).
`query`::
(optional, string): Free-text query string.
`filter`::
(optional, string): Additional filtering criteria.
`tags`::
(optional, string or array): Tags to filter monitors.
`monitorTypes`::
(optional, string or array): Monitor types to filter, (e.g., `http` , `tcp` , `icmp` or `browser`)
`locations`::
(optional, string or array): Locations to filter by.
`projects`::
(optional, string or array): Projects to filter by.
`schedules`::
(optional, string or array): Schedules to filter by.
`status`::
(optional, string or array): Status to filter by.
==== Examples
Here is an example of how to use this API:
[source,sh]
--------------------------------------------------
GET /api/synthetics/monitors?tags=prod&monitorTypes=http&locations=us-east-1&projects=project1&status=up
{
"page": 1,
"total": 24,
"monitors": [
{
"type": "icmp",
"enabled": false,
"alert": {
"status": {
"enabled": true
},
"tls": {
"enabled": true
}
},
"schedule": {
"number": "3",
"unit": "m"
},
"config_id": "e59142e5-1fe3-4aae-b0b0-19d6345e65a1",
"timeout": "16",
"name": "8.8.8.8:80",
"locations": [
{
"id": "us_central",
"label": "North America - US Central",
"geo": {
"lat": 41.25,
"lon": -95.86
},
"isServiceManaged": true
}
],
"namespace": "default",
"origin": "ui",
"id": "e59142e5-1fe3-4aae-b0b0-19d6345e65a1",
"max_attempts": 2,
"wait": "7",
"revision": 3,
"mode": "all",
"ipv4": true,
"ipv6": true,
"created_at": "2023-11-07T09:57:04.152Z",
"updated_at": "2023-12-04T19:19:34.039Z",
"host": "8.8.8.8:80"
}
],
"absoluteTotal": 24,
"perPage": 10,
}
--------------------------------------------------