get-calendar-event.asciidoc 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. [role="xpack"]
  2. [[ml-get-calendar-event]]
  3. === Get Scheduled Events API
  4. ++++
  5. <titleabbrev>Get Scheduled Events</titleabbrev>
  6. ++++
  7. Retrieves information about the scheduled events in
  8. calendars.
  9. ==== Request
  10. `GET _xpack/ml/calendars/<calendar_id>/events` +
  11. `GET _xpack/ml/calendars/_all/events`
  12. ===== Description
  13. You can get scheduled event information for a single calendar or for all
  14. calendars by using `_all`.
  15. ==== Path Parameters
  16. `calendar_id` (required)::
  17. (string) Identifier for the calendar.
  18. ==== Request Body
  19. `end`::
  20. (string) Specifies to get events with timestamps earlier than this time.
  21. `from`::
  22. (integer) Skips the specified number of events.
  23. `size`::
  24. (integer) Specifies the maximum number of events to obtain.
  25. `start`::
  26. (string) Specifies to get events with timestamps after this time.
  27. ==== Results
  28. The API returns the following information:
  29. `events`::
  30. (array) An array of scheduled event resources.
  31. For more information, see <<ml-event-resource>>.
  32. ==== Authorization
  33. You must have `monitor_ml`, `monitor`, `manage_ml`, or `manage` cluster
  34. privileges to use this API. For more information, see
  35. {xpack-ref}/security-privileges.html[Security Privileges].
  36. ==== Examples
  37. The following example gets information about the scheduled events in the
  38. `planned-outages` calendar:
  39. [source,js]
  40. --------------------------------------------------
  41. GET _xpack/ml/calendars/planned-outages/events
  42. --------------------------------------------------
  43. // CONSOLE
  44. // TEST[setup:calendar_outages_addevent]
  45. The API returns the following results:
  46. [source,js]
  47. ----
  48. {
  49. "count": 3,
  50. "events": [
  51. {
  52. "description": "event 1",
  53. "start_time": 1513641600000,
  54. "end_time": 1513728000000,
  55. "calendar_id": "planned-outages",
  56. "event_id": "LS8LJGEBMTCMA-qz49st"
  57. },
  58. {
  59. "description": "event 2",
  60. "start_time": 1513814400000,
  61. "end_time": 1513900800000,
  62. "calendar_id": "planned-outages",
  63. "event_id": "Li8LJGEBMTCMA-qz49st"
  64. },
  65. {
  66. "description": "event 3",
  67. "start_time": 1514160000000,
  68. "end_time": 1514246400000,
  69. "calendar_id": "planned-outages",
  70. "event_id": "Ly8LJGEBMTCMA-qz49st"
  71. }
  72. ]
  73. }
  74. ----
  75. // TESTRESPONSE[s/LS8LJGEBMTCMA-qz49st/$body.$_path/]
  76. // TESTRESPONSE[s/Li8LJGEBMTCMA-qz49st/$body.$_path/]
  77. // TESTRESPONSE[s/Ly8LJGEBMTCMA-qz49st/$body.$_path/]
  78. For more information about these properties, see <<ml-event-resource>>.