get-calendar.asciidoc 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. [role="xpack"]
  2. [[ml-get-calendar]]
  3. = Get calendars API
  4. ++++
  5. <titleabbrev>Get calendars</titleabbrev>
  6. ++++
  7. Retrieves configuration information for calendars.
  8. [[ml-get-calendar-request]]
  9. == {api-request-title}
  10. `GET _ml/calendars/<calendar_id>` +
  11. `GET _ml/calendars/_all`
  12. [[ml-get-calendar-prereqs]]
  13. == {api-prereq-title}
  14. Requires the `monitor_ml` cluster privilege. This privilege is included in the
  15. `machine_learning_user` built-in role.
  16. [[ml-get-calendar-desc]]
  17. == {api-description-title}
  18. You can get information for multiple calendars in a single API request by using a
  19. comma-separated list of ids or a wildcard expression. You can get
  20. information for all calendars by using `_all`, by specifying `*` as the
  21. `<calendar_id>`, or by omitting the `<calendar_id>`.
  22. For more information, see
  23. {ml-docs}/ml-ad-finding-anomalies.html#ml-ad-calendars[Calendars and scheduled events].
  24. [[ml-get-calendar-path-parms]]
  25. == {api-path-parms-title}
  26. `<calendar_id>`::
  27. (Required, string)
  28. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=calendar-id]
  29. [[ml-get-calendar-query-parms]]
  30. == {api-query-parms-title}
  31. `from`::
  32. (Optional, integer) Skips the specified number of calendars. This parameter
  33. is supported only when you omit the `<calendar_id>`. Defaults to `0`.
  34. `size`::
  35. (Optional, integer) Specifies the maximum number of calendars to obtain.
  36. This parameter is supported only when you omit the `<calendar_id>`. Defaults
  37. to `100`.
  38. [[ml-get-calendar-request-body]]
  39. == {api-request-body-title}
  40. `page`.`from`::
  41. (Optional, integer) Skips the specified number of calendars. This object is
  42. supported only when you omit the `<calendar_id>`. Defaults to `0`.
  43. `page`.`size`::
  44. (Optional, integer) Specifies the maximum number of calendars to obtain.
  45. This object is supported only when you omit the `<calendar_id>`. Defaults
  46. to `100`.
  47. [[ml-get-calendar-results]]
  48. == {api-response-body-title}
  49. The API returns an array of calendar resources, which have the following
  50. properties:
  51. `calendar_id`::
  52. (string)
  53. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=calendar-id]
  54. `job_ids`::
  55. (array) An array of {anomaly-job} identifiers. For example:
  56. `["total-requests"]`.
  57. [[ml-get-calendar-example]]
  58. == {api-examples-title}
  59. [source,console]
  60. --------------------------------------------------
  61. GET _ml/calendars/planned-outages
  62. --------------------------------------------------
  63. // TEST[skip:setup:calendar_outages_addjob]
  64. The API returns the following results:
  65. [source,console-result]
  66. ----
  67. {
  68. "count": 1,
  69. "calendars": [
  70. {
  71. "calendar_id": "planned-outages",
  72. "job_ids": [
  73. "total-requests"
  74. ]
  75. }
  76. ]
  77. }
  78. ----