Get scheduled events API

edit

Retrieves information about the scheduled events in calendars.

Request

edit

GET _xpack/ml/calendars/<calendar_id>/events

GET _xpack/ml/calendars/_all/events

Description

edit

You can get scheduled event information for a single calendar or for all calendars by using _all.

Path Parameters

edit
calendar_id (required)
(string) Identifier for the 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.
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.

Results

edit

The API returns the following information:

events
(array) An array of scheduled event resources. For more information, see Scheduled event resources.

Authorization

edit

You must have monitor_ml, monitor, manage_ml, or manage cluster privileges to use this API. For more information, see Security privileges.

Examples

edit

The following example gets information about the scheduled events in the planned-outages calendar:

GET _xpack/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"
    }
  ]
}

For more information about these properties, see Scheduled event resources.

The following example retrieves scheduled events that occur within a specific period of time:

GET _xpack/ml/calendars/planned-outages/events?start=1635638400000&end=1635724800000