get-calendar.asciidoc 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. <<security-privileges>> and {ml-docs-setup-privileges}.
  18. [[ml-get-calendar-desc]]
  19. == {api-description-title}
  20. You can get information for multiple calendars in a single API request by using a
  21. comma-separated list of ids or a wildcard expression. You can get
  22. information for all calendars by using `_all`, by specifying `*` as the
  23. `<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-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-request-body]]
  32. == {api-request-body-title}
  33. `page`.`from`::
  34. (Optional, integer) Skips the specified number of calendars.
  35. `page`.`size`::
  36. (Optional, integer) Specifies the maximum number of calendars to obtain.
  37. [[ml-get-calendar-results]]
  38. == {api-response-body-title}
  39. The API returns an array of calendar resources, which have the following
  40. properties:
  41. `calendar_id`::
  42. (string)
  43. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=calendar-id]
  44. `job_ids`::
  45. (array) An array of {anomaly-job} identifiers. For example:
  46. `["total-requests"]`.
  47. [[ml-get-calendar-example]]
  48. == {api-examples-title}
  49. [source,console]
  50. --------------------------------------------------
  51. GET _ml/calendars/planned-outages
  52. --------------------------------------------------
  53. // TEST[skip:setup:calendar_outages_addjob]
  54. The API returns the following results:
  55. [source,console-result]
  56. ----
  57. {
  58. "count": 1,
  59. "calendars": [
  60. {
  61. "calendar_id": "planned-outages",
  62. "job_ids": [
  63. "total-requests"
  64. ]
  65. }
  66. ]
  67. }
  68. ----