get-calendar-event.asciidoc 2.4 KB

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