get-calendar.asciidoc 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. Requires the `monitor_ml` cluster privilege. This privilege is included in the
  16. `machine_learning_user` built-in role.
  17. [[ml-get-calendar-desc]]
  18. == {api-description-title}
  19. You can get information for multiple calendars in a single API request by using a
  20. comma-separated list of ids or a wildcard expression. You can get
  21. information for all calendars by using `_all`, by specifying `*` as the
  22. `<calendar_id>`, or by omitting the `<calendar_id>`.
  23. For more information, see
  24. {ml-docs}/ml-calendars.html[Calendars and scheduled events].
  25. [[ml-get-calendar-path-parms]]
  26. == {api-path-parms-title}
  27. `<calendar_id>`::
  28. (Required, string)
  29. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=calendar-id]
  30. [[ml-get-calendar-request-body]]
  31. == {api-request-body-title}
  32. `page`.`from`::
  33. (Optional, integer) Skips the specified number of calendars.
  34. `page`.`size`::
  35. (Optional, integer) Specifies the maximum number of calendars to obtain.
  36. [[ml-get-calendar-results]]
  37. == {api-response-body-title}
  38. The API returns an array of calendar resources, which have the following
  39. properties:
  40. `calendar_id`::
  41. (string)
  42. include::{es-repo-dir}/ml/ml-shared.asciidoc[tag=calendar-id]
  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. [source,console]
  49. --------------------------------------------------
  50. GET _ml/calendars/planned-outages
  51. --------------------------------------------------
  52. // TEST[skip:setup:calendar_outages_addjob]
  53. The API returns the following results:
  54. [source,console-result]
  55. ----
  56. {
  57. "count": 1,
  58. "calendars": [
  59. {
  60. "calendar_id": "planned-outages",
  61. "job_ids": [
  62. "total-requests"
  63. ]
  64. }
  65. ]
  66. }
  67. ----