get-calendar-event.asciidoc 3.2 KB

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