IMPORTANT: No additional bug fixes or documentation updates
will be released for this version. For the latest information, see the
current release documentation.
Get scheduled events API
editGet scheduled events API
editRetrieves information about the scheduled events in calendars.
Prerequisites
editRequires the monitor_ml
cluster privilege. This privilege is included in the
machine_learning_user
built-in role.
Description
editYou can get scheduled event information for multiple calendars in a single
API request by using a comma-separated list of ids or a wildcard expression.
You can get scheduled event information for all calendars by using _all
or *
as the <calendar_id>
.
For more information, see Calendars and scheduled events.
Path parameters
edit-
<calendar_id>
- (Required, string) A string that uniquely identifies a calendar.
Query parameters
edit-
end
- (Optional, string) Specifies to get events with timestamps earlier than this time.
-
from
-
(Optional, integer) Skips the specified number of events. Defaults to
0
. -
job_id
-
(Optional, string) Specifies to get events for a specific anomaly detection job
identifier or job group. It must be used with a calendar identifier of
_all
or*
. -
size
-
(Optional, integer) Specifies the maximum number of events to obtain. Defaults
to
100
. -
start
- (Optional, string) Specifies to get events with timestamps after this time.
Request body
edit-
end
- (Optional, string) Specifies to get events with timestamps earlier than this time. Defaults to unset, which means results are not limited to specific timestamps.
-
job_id
-
(Optional, string) Specifies to get events for a specific anomaly detection job
identifier or job group. It must be used with a calendar identifier of
_all
or*
. -
page.from
-
(Optional, integer) Skips the specified number of events. Defaults to
0
. -
page.size
-
(Optional, integer) Specifies the maximum number of events to obtain.
Defaults to
100
. -
start
- (Optional, string) Specifies to get events with timestamps after this time. Defaults to unset, which means results are not limited to specific timestamps.
Response body
editThe API returns an array of scheduled event resources, which have the following properties:
-
calendar_id
- (string) A string that uniquely identifies a calendar.
-
description
- (string) A description of the scheduled event.
-
end_time
- (date) The timestamp for the end of the scheduled event in milliseconds since the epoch or ISO 8601 format.
-
event_id
- (string) An automatically-generated identifier for the scheduled event.
-
start_time
- (date) The timestamp for the beginning of the scheduled event in milliseconds since the epoch or ISO 8601 format.
Examples
editGET _ml/calendars/planned-outages/events
The API returns the following results:
{ "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" } ] }
The following example retrieves scheduled events that occur within a specific period of time:
GET _ml/calendars/planned-outages/events?start=1635638400000&end=1635724800000