get-calendar.asciidoc 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. [role="xpack"]
  2. [testenv="platinum"]
  3. [[ml-get-calendar]]
  4. === Get calendars API
  5. ++++
  6. <titleabbrev>Get calendars</titleabbrev>
  7. ++++
  8. Retrieves configuration information for calendars.
  9. [[ml-get-calendar-request]]
  10. ==== {api-request-title}
  11. `GET _ml/calendars/<calendar_id>` +
  12. `GET _ml/calendars/_all`
  13. [[ml-get-calendar-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. {stack-ov}/security-privileges.html[Security privileges].
  18. [[ml-get-calendar-desc]]
  19. ==== {api-description-title}
  20. You can get information for a single calendar or for all calendars by using
  21. `_all`.
  22. For more information, see
  23. {stack-ov}/ml-calendars.html[Calendars and scheduled events].
  24. [[ml-get-calendar-path-parms]]
  25. ==== {api-path-parms-title}
  26. `<calendar_id>`::
  27. (Required, string) Identifier for the calendar.
  28. [[ml-get-calendar-request-body]]
  29. ==== {api-request-body-title}
  30. `page`::
  31. `from`:::
  32. (Optional, integer) Skips the specified number of calendars.
  33. `size`:::
  34. (Optional, integer) Specifies the maximum number of calendars to obtain.
  35. [[ml-get-calendar-results]]
  36. ==== {api-response-body-title}
  37. The API returns the following information:
  38. `calendars`::
  39. (array) An array of calendar resources. A calendar resource has the following
  40. properties:
  41. `calendar_id`:::
  42. (string) A numerical character string that uniquely identifies the calendar.
  43. `job_ids`:::
  44. (array) An array of {anomaly-job} identifiers. For example:
  45. `["total-requests"]`.
  46. [[ml-get-calendar-example]]
  47. ==== {api-examples-title}
  48. The following example gets configuration information for the `planned-outages`
  49. calendar:
  50. [source,js]
  51. --------------------------------------------------
  52. GET _ml/calendars/planned-outages
  53. --------------------------------------------------
  54. // CONSOLE
  55. // TEST[skip:setup:calendar_outages_addjob]
  56. The API returns the following results:
  57. [source,console-result]
  58. ----
  59. {
  60. "count": 1,
  61. "calendars": [
  62. {
  63. "calendar_id": "planned-outages",
  64. "job_ids": [
  65. "total-requests"
  66. ]
  67. }
  68. ]
  69. }
  70. ----