mirror of
https://github.com/elastic/kibana.git
synced 2025-06-27 18:51:07 -04:00
51 lines
No EOL
2.2 KiB
YAML
51 lines
No EOL
2.2 KiB
YAML
post:
|
|
summary: Creates a rule with a randomly generated rule identifier.
|
|
operationId: createRule
|
|
description: >
|
|
To create a rule, you must have `all` privileges for the appropriate Kibana features, depending on the `consumer` and `rule_type_id` of the rule you're creating.
|
|
For example, you must have privileges for the **Management > Stack rules** feature, **Analytics > Discover** and **Machine Learning** features, **Observability** features, or **Security** features.
|
|
If the rule has actions, you must also have `read` privileges for the **Management > Actions and Connectors** feature.
|
|
This API supports both key- and token-based authentication.
|
|
To use key-based authentication, create an API key in Kibana and use it in the header of the API call.
|
|
To use token-based authentication, provide a username and password; an API key that matches the current privileges of the user is created automatically.
|
|
In both cases, the API key is subsequently used for authorization when the rule runs.
|
|
tags:
|
|
- alerting
|
|
parameters:
|
|
- $ref: ../components/headers/kbn_xsrf.yaml
|
|
- $ref: '../components/parameters/space_id.yaml'
|
|
requestBody:
|
|
required: true
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '../components/schemas/create_rule_request.yaml'
|
|
examples:
|
|
createRuleRequest:
|
|
$ref: '../components/examples/create_rule_request.yaml'
|
|
responses:
|
|
'200':
|
|
description: Indicates a successful call.
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '../components/schemas/rule_response_properties.yaml'
|
|
examples:
|
|
createRuleResponse:
|
|
$ref: '../components/examples/create_rule_response.yaml'
|
|
'401':
|
|
description: Authorization information is missing or invalid.
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '../components/schemas/401_response.yaml'
|
|
'404':
|
|
description: Object is not found.
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: '../components/schemas/404_response.yaml'
|
|
servers:
|
|
- url: https://localhost:5601
|
|
servers:
|
|
- url: https://localhost:5601 |