Rules API
This API allows managing rules in the system. It provides endpoints to create, read, update, and delete rules, as well as perform specific operations such as updating alerts associated with a rule.
The Rule Object
The Rule object represents a rule in the system.
Attributes
| Attribute | Description | Type |
|---|---|---|
id | Unique identifier of the rule | String |
code | Unique code of the rule | String |
label | Descriptive label of the rule | String |
alerts | List of alerts associated with the rule | Array of Object |
createdAt | Date and time of rule creation | String (ISO 8601) |
updatedAt | Date and time of the last update | String (ISO 8601) |
Available Operations
Create a New Rule
Creates a new rule in the system.
Input Parameters:
| Parameter | Description | Type | Required |
|---|---|---|---|
label | Descriptive label of the rule | String | Yes |
code | Unique code of the rule | String | Yes |
alerts | List of rule alerts | Array of Object | Yes |
Example Request:
Successful Response:
Get a Rule
Retrieves information about a specific rule.
Path Parameters:
| Parameter | Description |
|---|---|
rule_id | ID of the rule to retrieve |
Successful Response:
The response will be a complete Rule object, as described above.
Update a Rule
Updates information of an existing rule.
Path Parameters:
| Parameter | Description |
|---|---|
rule_id | ID of the rule to update |
Input Parameters:
| Parameter | Description | Type |
|---|---|---|
label | New label of the rule | String |
code | New code of the rule | String |
alerts | New list of alerts | Array of Object |
Example Request:
Successful Response:
The response will be the updated Rule object.
Delete a Rule
Deletes a rule from the system.
Path Parameters:
| Parameter | Description |
|---|---|
rule_id | ID of the rule to delete |
Successful Response:
Status code 204 (No Content) if the deletion was successful.
List Rules
Retrieves a paginated list of rules with filtering and sorting options.
Query Parameters:
| Parameter | Description | Type |
|---|---|---|
search | Text to search in rules | String |
code | Filter by rule code | String |
page | Page number (default: 1) | Integer |
per-page | Items per page (default: 10) | Integer |
sort-by | Field to sort by | String |
sort-direction | Sorting direction (asc or desc) | String |
Successful Response:
The response will be a paginated list of Rule objects.
Error Handling
The API can return the following error codes:
| Code | Description |
|---|---|
| 400 | Bad Request |
| 401 | Unauthorized |
| 403 | Forbidden |
| 404 | Not Found |
| 500 | Internal Server Error |
Errors will include a descriptive message in the response body.