OpenSearch/docs/reference/ml/apis/get-calendar-event.asciidoc

111 lines
2.8 KiB
Plaintext
Raw Normal View History

[role="xpack"]
[testenv="platinum"]
[[ml-get-calendar-event]]
2018-12-20 13:23:28 -05:00
=== Get scheduled events API
++++
2018-12-20 13:23:28 -05:00
<titleabbrev>Get scheduled events</titleabbrev>
++++
2018-06-13 16:37:35 -04:00
Retrieves information about the scheduled events in
calendars.
[[ml-get-calendar-event-request]]
==== {api-request-title}
`GET _ml/calendars/<calendar_id>/events` +
`GET _ml/calendars/_all/events`
[[ml-get-calendar-event-prereqs]]
==== {api-prereq-title}
* If the {es} {security-features} are enabled, you must have `monitor_ml`,
`monitor`, `manage_ml`, or `manage` cluster privileges to use this API. See
{stack-ov}/security-privileges.html[Security privileges].
[[ml-get-calendar-event-desc]]
==== {api-description-title}
You can get scheduled event information for a single calendar or for all
calendars by using `_all`.
[[ml-get-calendar-event-path-parms]]
==== {api-path-parms-title}
`<calendar_id>` (Required)::
(string) Identifier for the calendar.
[[ml-get-calendar-event-request-body]]
==== {api-request-body-title}
`end` (Optional)::
(string) Specifies to get events with timestamps earlier than this time.
`from` (Optional)::
(integer) Skips the specified number of events.
`size` (Optional)::
(integer) Specifies the maximum number of events to obtain.
`start` (Optional)::
(string) Specifies to get events with timestamps after this time.
[[ml-get-calendar-event-results]]
==== {api-response-body-title}
The API returns the following information:
`events`::
(array) An array of scheduled event resources.
For more information, see <<ml-event-resource>>.
[[ml-get-calendar-event-example]]
==== {api-examples-title}
The following example gets information about the scheduled events in the
`planned-outages` calendar:
[source,js]
--------------------------------------------------
GET _ml/calendars/planned-outages/events
--------------------------------------------------
// CONSOLE
// TEST[skip:setup:calendar_outages_addevent]
The API returns the following results:
[source,js]
----
{
"count": 3,
"events": [
{
"description": "event 1",
"start_time": 1513641600000,
"end_time": 1513728000000,
"calendar_id": "planned-outages",
"event_id": "LS8LJGEBMTCMA-qz49st"
},
{
"description": "event 2",
"start_time": 1513814400000,
"end_time": 1513900800000,
"calendar_id": "planned-outages",
"event_id": "Li8LJGEBMTCMA-qz49st"
},
{
"description": "event 3",
"start_time": 1514160000000,
"end_time": 1514246400000,
"calendar_id": "planned-outages",
"event_id": "Ly8LJGEBMTCMA-qz49st"
}
]
}
----
// TESTRESPONSE[s/LS8LJGEBMTCMA-qz49st/$body.$_path/]
// TESTRESPONSE[s/Li8LJGEBMTCMA-qz49st/$body.$_path/]
// TESTRESPONSE[s/Ly8LJGEBMTCMA-qz49st/$body.$_path/]
For more information about these properties, see <<ml-event-resource>>.