get-calendar-event.asciidoc 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. [role="xpack"]
  2. [testenv="platinum"]
  3. [[ml-get-calendar-event]]
  4. === Get scheduled events API
  5. ++++
  6. <titleabbrev>Get scheduled events</titleabbrev>
  7. ++++
  8. Retrieves information about the scheduled events in calendars.
  9. [[ml-get-calendar-event-request]]
  10. ==== {api-request-title}
  11. `GET _ml/calendars/<calendar_id>/events` +
  12. `GET _ml/calendars/_all/events`
  13. [[ml-get-calendar-event-prereqs]]
  14. ==== {api-prereq-title}
  15. * If the {es} {security-features} are enabled, you must have `monitor_ml`,
  16. `monitor`, `manage_ml`, or `manage` cluster privileges to use this API. See
  17. <<security-privileges>>.
  18. [[ml-get-calendar-event-desc]]
  19. ==== {api-description-title}
  20. You can get scheduled event information for a single calendar or for all
  21. calendars by using `_all`.
  22. For more information, see
  23. {ml-docs}/ml-calendars.html[Calendars and scheduled events].
  24. [[ml-get-calendar-event-path-parms]]
  25. ==== {api-path-parms-title}
  26. `<calendar_id>`::
  27. (Required, string) Identifier for the calendar.
  28. [[ml-get-calendar-event-request-body]]
  29. ==== {api-request-body-title}
  30. `end`::
  31. (Optional, string) Specifies to get events with timestamps earlier than this
  32. time.
  33. `from`::
  34. (Optional, integer) Skips the specified number of events.
  35. `size`::
  36. (Optional, integer) Specifies the maximum number of events to obtain.
  37. `start`::
  38. (Optional, string) Specifies to get events with timestamps after this time.
  39. [[ml-get-calendar-event-results]]
  40. ==== {api-response-body-title}
  41. The API returns an array of scheduled event resources, which have the
  42. following properties:
  43. `calendar_id`::
  44. (string) An identifier for the calendar that contains the scheduled
  45. event.
  46. `description`::
  47. (string) A description of the scheduled event.
  48. `end_time`::
  49. (date) The timestamp for the end of the scheduled event
  50. in milliseconds since the epoch or ISO 8601 format.
  51. `event_id`::
  52. (string) An automatically-generated identifier for the scheduled event.
  53. `start_time`::
  54. (date) The timestamp for the beginning of the scheduled event
  55. in milliseconds since the epoch or ISO 8601 format.
  56. [[ml-get-calendar-event-example]]
  57. ==== {api-examples-title}
  58. [source,console]
  59. --------------------------------------------------
  60. GET _ml/calendars/planned-outages/events
  61. --------------------------------------------------
  62. // TEST[skip:setup:calendar_outages_addevent]
  63. The API returns the following results:
  64. [source,console-result]
  65. ----
  66. {
  67. "count": 3,
  68. "events": [
  69. {
  70. "description": "event 1",
  71. "start_time": 1513641600000,
  72. "end_time": 1513728000000,
  73. "calendar_id": "planned-outages",
  74. "event_id": "LS8LJGEBMTCMA-qz49st"
  75. },
  76. {
  77. "description": "event 2",
  78. "start_time": 1513814400000,
  79. "end_time": 1513900800000,
  80. "calendar_id": "planned-outages",
  81. "event_id": "Li8LJGEBMTCMA-qz49st"
  82. },
  83. {
  84. "description": "event 3",
  85. "start_time": 1514160000000,
  86. "end_time": 1514246400000,
  87. "calendar_id": "planned-outages",
  88. "event_id": "Ly8LJGEBMTCMA-qz49st"
  89. }
  90. ]
  91. }
  92. ----
  93. // TESTRESPONSE[s/LS8LJGEBMTCMA-qz49st/$body.$_path/]
  94. // TESTRESPONSE[s/Li8LJGEBMTCMA-qz49st/$body.$_path/]
  95. // TESTRESPONSE[s/Ly8LJGEBMTCMA-qz49st/$body.$_path/]