Add events to calendar API

Posts scheduled events in a calendar.

Request

POST _ml/calendars/<calendar_id>/events

Prerequisites

Description

This API accepts a list of scheduled events, each of which must have a start time, end time, and description.

Path parameters

<calendar_id>

(Required, string) A string that uniquely identifies a calendar.

Request body

events

(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.

Properties of events

  • description

    (Optional, string) A description of the scheduled event.

    end_time

    (Required, date) The timestamp for the end of the scheduled event in milliseconds since the epoch or ISO 8601 format.

    start_time

    (Required, date) The timestamp for the beginning of the scheduled event in milliseconds since the epoch or ISO 8601 format.

Examples

  1. POST _ml/calendars/planned-outages/events
  2. {
  3. "events" : [
  4. {"description": "event 1", "start_time": 1513641600000, "end_time": 1513728000000},
  5. {"description": "event 2", "start_time": 1513814400000, "end_time": 1513900800000},
  6. {"description": "event 3", "start_time": 1514160000000, "end_time": 1514246400000}
  7. ]
  8. }

The API returns the following results:

  1. {
  2. "events": [
  3. {
  4. "description": "event 1",
  5. "start_time": 1513641600000,
  6. "end_time": 1513728000000,
  7. "calendar_id": "planned-outages"
  8. },
  9. {
  10. "description": "event 2",
  11. "start_time": 1513814400000,
  12. "end_time": 1513900800000,
  13. "calendar_id": "planned-outages"
  14. },
  15. {
  16. "description": "event 3",
  17. "start_time": 1514160000000,
  18. "end_time": 1514246400000,
  19. "calendar_id": "planned-outages"
  20. }
  21. ]
  22. }