get-calendar-event.asciidoc 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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>> and {ml-docs-setup-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)
  28. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=calendar-id]
  29. [[ml-get-calendar-event-request-body]]
  30. == {api-request-body-title}
  31. `end`::
  32. (Optional, string) Specifies to get events with timestamps earlier than this
  33. time.
  34. `from`::
  35. (Optional, integer) Skips the specified number of events.
  36. `size`::
  37. (Optional, integer) Specifies the maximum number of events to obtain.
  38. `start`::
  39. (Optional, string) Specifies to get events with timestamps after this time.
  40. [[ml-get-calendar-event-results]]
  41. == {api-response-body-title}
  42. The API returns an array of scheduled event resources, which have the
  43. following properties:
  44. `calendar_id`::
  45. (string)
  46. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=calendar-id]
  47. `description`::
  48. (string) A description of the scheduled event.
  49. `end_time`::
  50. (date) The timestamp for the end of the scheduled event in milliseconds since
  51. the epoch or ISO 8601 format.
  52. `event_id`::
  53. (string) An automatically-generated identifier for the scheduled event.
  54. `start_time`::
  55. (date) The timestamp for the beginning of the scheduled event in milliseconds
  56. since the epoch or ISO 8601 format.
  57. [[ml-get-calendar-event-example]]
  58. == {api-examples-title}
  59. [source,console]
  60. --------------------------------------------------
  61. GET _ml/calendars/planned-outages/events
  62. --------------------------------------------------
  63. // TEST[skip:setup:calendar_outages_addevent]
  64. The API returns the following results:
  65. [source,console-result]
  66. ----
  67. {
  68. "count": 3,
  69. "events": [
  70. {
  71. "description": "event 1",
  72. "start_time": 1513641600000,
  73. "end_time": 1513728000000,
  74. "calendar_id": "planned-outages",
  75. "event_id": "LS8LJGEBMTCMA-qz49st"
  76. },
  77. {
  78. "description": "event 2",
  79. "start_time": 1513814400000,
  80. "end_time": 1513900800000,
  81. "calendar_id": "planned-outages",
  82. "event_id": "Li8LJGEBMTCMA-qz49st"
  83. },
  84. {
  85. "description": "event 3",
  86. "start_time": 1514160000000,
  87. "end_time": 1514246400000,
  88. "calendar_id": "planned-outages",
  89. "event_id": "Ly8LJGEBMTCMA-qz49st"
  90. }
  91. ]
  92. }
  93. ----
  94. // TESTRESPONSE[s/LS8LJGEBMTCMA-qz49st/$body.$_path/]
  95. // TESTRESPONSE[s/Li8LJGEBMTCMA-qz49st/$body.$_path/]
  96. // TESTRESPONSE[s/Ly8LJGEBMTCMA-qz49st/$body.$_path/]