POST /api/alerting/rules/backfill/_schedule

Spaces method and path for this operation:

post /s/{space_id}/api/alerting/rules/backfill/_schedule

Refer to Spaces for more information.

Headers

  • kbn-xsrf string Required

    A required header to protect against CSRF attacks

application/json

Body

  • ranges array[object] Required
    Hide ranges attributes Show ranges attributes object
    • end string Required
    • start string Required
  • rule_id string Required
  • run_actions boolean

Responses

  • 200 application/json

    Indicates a successful call.

    Any of:
  • 400

    Indicates an invalid schema or parameters.

  • 403

    Indicates that this call is forbidden.

  • 404

    Indicates a rule with the given ID does not exist.

POST /api/alerting/rules/backfill/_schedule
curl \
 --request POST 'https://localhost:5601/api/alerting/rules/backfill/_schedule' \
 --header "Authorization: $API_KEY" \
 --header "Content-Type: application/json" \
 --header "kbn-xsrf: true" \
 --data '[{"ranges":[{"end":"2024-01-02T00:00:00.000Z","start":"2024-01-01T00:00:00.000Z"}],"rule_id":"3583a470-74f6-11ed-9801-35303b735aef"}]'
Request example
[
  {
    "ranges": [
      {
        "end": "2024-01-02T00:00:00.000Z",
        "start": "2024-01-01T00:00:00.000Z"
      }
    ],
    "rule_id": "3583a470-74f6-11ed-9801-35303b735aef"
  }
]
Response examples (200)
[
  {
    "id": "85bdf571-f4fb-4666-a8d2-e05e1220ebc6",
    "rule": {
      "id": "3583a470-74f6-11ed-9801-35303b735aef",
      "name": "my alert",
      "tags": [
        "cpu"
      ],
      "params": {
        "index": [
          "test-index"
        ],
        "aggType": "avg",
        "groupBy": "top",
        "aggField": "sheet.version",
        "termSize": 6,
        "termField": "name.keyword",
        "threshold": [
          1000
        ],
        "timeField": "@timestamp",
        "timeWindowSize": 5,
        "timeWindowUnit": "m",
        "thresholdComparator": ">"
      },
      "enabled": true,
      "consumer": "alerts",
      "revision": 0,
      "schedule": {
        "interval": "1m"
      },
      "created_at": "2022-12-05T23:40:33.132Z",
      "created_by": "elastic",
      "updated_at": "2022-12-05T23:40:33.132Z",
      "updated_by": "elastic",
      "rule_type_id": ".index-threshold",
      "api_key_owner": "elastic"
    },
    "start": "2024-01-01T00:00:00.000Z",
    "status": "pending",
    "enabled": true,
    "duration": "12h",
    "schedule": [
      {
        "run_at": "2024-01-01T12:00:00.000Z",
        "status": "pending",
        "interval": "12h"
      },
      {
        "run_at": "2024-01-02T00:00:00.000Z",
        "status": "pending",
        "interval": "12h"
      }
    ],
    "space_id": "default",
    "initiator": "user",
    "created_at": "2024-01-30T00:00:00.000Z"
  }
]