You can create or modify Event Rules by sending requests to the /rest/v4/events/rules/{id} endpoint. Because Event Rules require complex JSON payloads with numerous mandatory attributes, the most efficient workflow is to use existing rules as templates.
1. Retrieve Existing Rules
Before creating or modifying a rule, perform a GET request to see the required structure and available attributes.
Endpoint:
GET /rest/v4/events/rulesPurpose: Use the returned JSON as a schema for your subsequent requests.
2. Modifying an Existing Event Rule
To update a rule, use the PATCH method. This allows you to update specific fields while keeping the rule's identity intact.
Method:
PATCHKey Requirement: You must include the existing
"id"attribute in your JSON payload.Process: Copy the JSON object from your
GETrequest, modify the desired parameters (e.g., changing a schedule or an action), and send it back to the server.
3. Creating a New Event Rule
To add a new rule, use the POST method with a complete JSON object.
Method:
POSTThe "id" Field: Every rule requires a unique identifier. Since the Nx Witness Server uses specific UUID formats, you should generate a new, valid unique ID for the
"id"field.Attribute Mapping: All other attributes and nested JSON objects must match the structure found in the server’s response to a standard
/rest/v4/events/rulesrequest.
| NOTE: Always refer to the REST API documentation (available via your server's web interface) for the most up-to-date list of obligatory attributes and nested object schemas. |
Comments
0 comments
Article is closed for comments.