2018-01-24 11:14:23 -05:00
|
|
|
[role="xpack"]
|
2018-08-31 19:49:24 -04:00
|
|
|
[testenv="platinum"]
|
2018-01-24 11:14:23 -05:00
|
|
|
[[ml-post-calendar-event]]
|
2018-12-20 13:23:28 -05:00
|
|
|
=== Add events to calendar API
|
2018-01-24 11:14:23 -05:00
|
|
|
++++
|
2018-12-20 13:23:28 -05:00
|
|
|
<titleabbrev>Add events to calendar</titleabbrev>
|
2018-01-24 11:14:23 -05:00
|
|
|
++++
|
|
|
|
|
2018-06-13 16:37:35 -04:00
|
|
|
Posts scheduled events in a calendar.
|
2018-01-24 11:14:23 -05:00
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-post-calendar-event-request]]
|
|
|
|
==== {api-request-title}
|
2018-01-24 11:14:23 -05:00
|
|
|
|
2018-12-07 15:34:11 -05:00
|
|
|
`POST _ml/calendars/<calendar_id>/events`
|
2018-01-24 11:14:23 -05:00
|
|
|
|
2019-06-27 16:58:42 -04:00
|
|
|
[[ml-post-calendar-event-prereqs]]
|
|
|
|
==== {api-prereq-title}
|
|
|
|
|
|
|
|
* If the {es} {security-features} are enabled, you must have `manage_ml` or
|
|
|
|
`manage` cluster privileges to use this API. See
|
2019-10-07 18:23:19 -04:00
|
|
|
<<security-privileges>>.
|
2019-06-27 16:58:42 -04:00
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-post-calendar-event-desc]]
|
|
|
|
==== {api-description-title}
|
2018-01-24 11:14:23 -05:00
|
|
|
|
2019-12-20 13:01:19 -05:00
|
|
|
This API accepts a list of {ml-docs}/ml-calendars.html[scheduled events], each
|
2018-01-24 11:14:23 -05:00
|
|
|
of which must have a start time, end time, and description.
|
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-post-calendar-event-path-parms]]
|
|
|
|
==== {api-path-parms-title}
|
2018-01-24 11:14:23 -05:00
|
|
|
|
2019-07-12 11:26:31 -04:00
|
|
|
`<calendar_id>`::
|
2020-01-02 14:23:26 -05:00
|
|
|
(Required, string)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=calendar-id]
|
2018-01-24 11:14:23 -05:00
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-post-calendar-event-request-body]]
|
|
|
|
==== {api-request-body-title}
|
2018-01-24 11:14:23 -05:00
|
|
|
|
2019-07-12 11:26:31 -04:00
|
|
|
`events`::
|
2020-01-02 14:23:26 -05:00
|
|
|
(Required, array) A list of one of more scheduled events. The event's start and
|
|
|
|
end times may be specified as integer milliseconds since the epoch or as a
|
|
|
|
string in ISO 8601 format. An event resource has the following properties:
|
2019-07-15 12:44:57 -04:00
|
|
|
|
2020-01-02 14:23:26 -05:00
|
|
|
`events`.`calendar_id`:::
|
|
|
|
(Optional, string)
|
|
|
|
include::{docdir}/ml/ml-shared.asciidoc[tag=calendar-id]
|
2019-07-15 12:44:57 -04:00
|
|
|
|
2020-01-02 14:23:26 -05:00
|
|
|
`events`.`description`:::
|
|
|
|
(Optional, string) A description of the scheduled event.
|
2019-07-15 12:44:57 -04:00
|
|
|
|
2020-01-02 14:23:26 -05:00
|
|
|
`events`.`end_time`:::
|
|
|
|
(Required, date) The timestamp for the end of the scheduled event in
|
|
|
|
milliseconds since the epoch or ISO 8601 format.
|
2019-07-15 12:44:57 -04:00
|
|
|
|
2020-01-02 14:23:26 -05:00
|
|
|
`events`.`start_time`:::
|
|
|
|
(Required, date) The timestamp for the beginning of the scheduled event in
|
|
|
|
milliseconds since the epoch or ISO 8601 format.
|
2018-01-24 11:14:23 -05:00
|
|
|
|
2019-06-27 12:42:47 -04:00
|
|
|
[[ml-post-calendar-event-example]]
|
|
|
|
==== {api-examples-title}
|
2018-01-24 11:14:23 -05:00
|
|
|
|
2019-09-06 11:31:13 -04:00
|
|
|
[source,console]
|
2018-01-24 11:14:23 -05:00
|
|
|
--------------------------------------------------
|
2018-12-07 15:34:11 -05:00
|
|
|
POST _ml/calendars/planned-outages/events
|
2018-01-24 11:14:23 -05:00
|
|
|
{
|
|
|
|
"events" : [
|
|
|
|
{"description": "event 1", "start_time": 1513641600000, "end_time": 1513728000000},
|
|
|
|
{"description": "event 2", "start_time": 1513814400000, "end_time": 1513900800000},
|
|
|
|
{"description": "event 3", "start_time": 1514160000000, "end_time": 1514246400000}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
2018-08-31 19:49:24 -04:00
|
|
|
// TEST[skip:setup:calendar_outages_addjob]
|
2018-01-24 11:14:23 -05:00
|
|
|
|
|
|
|
The API returns the following results:
|
|
|
|
|
2019-09-06 09:22:08 -04:00
|
|
|
[source,console-result]
|
2018-01-24 11:14:23 -05:00
|
|
|
----
|
|
|
|
{
|
|
|
|
"events": [
|
|
|
|
{
|
|
|
|
"description": "event 1",
|
|
|
|
"start_time": 1513641600000,
|
|
|
|
"end_time": 1513728000000,
|
|
|
|
"calendar_id": "planned-outages"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"description": "event 2",
|
|
|
|
"start_time": 1513814400000,
|
|
|
|
"end_time": 1513900800000,
|
|
|
|
"calendar_id": "planned-outages"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"description": "event 3",
|
|
|
|
"start_time": 1514160000000,
|
|
|
|
"end_time": 1514246400000,
|
|
|
|
"calendar_id": "planned-outages"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
----
|