| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 | [role="xpack"][testenv="platinum"][[ml-get-calendar-event]]=== Get scheduled events API++++<titleabbrev>Get scheduled events</titleabbrev>++++Retrieves information about the scheduled events incalendars.==== Request`GET _ml/calendars/<calendar_id>/events` +`GET _ml/calendars/_all/events`===== DescriptionYou can get scheduled event information for a single calendar or for allcalendars by using `_all`.==== Path Parameters`calendar_id` (required)::  (string) Identifier for the calendar.==== Request Body`end`::    (string) Specifies to get events with timestamps earlier than this time.`from`::    (integer) Skips the specified number of events.`size`::    (integer) Specifies the maximum number of events to obtain.`start`::    (string) Specifies to get events with timestamps after this time.==== ResultsThe API returns the following information:`events`::  (array) An array of scheduled event resources.  For more information, see <<ml-event-resource>>.==== AuthorizationYou must have `monitor_ml`, `monitor`, `manage_ml`, or `manage` clusterprivileges to use this API. For more information, see{xpack-ref}/security-privileges.html[Security Privileges].==== ExamplesThe 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>>.
 |