get-calendar-event.asciidoc 3.3 KB

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