|
| 1 | +# AlarmRuleControllerApi |
| 2 | + |
| 3 | +`ThingsboardClient` methods: |
| 4 | + |
| 5 | +``` |
| 6 | +void deleteAlarmRule(@Nonnull String alarmRuleId) // Delete Alarm Rule (deleteAlarmRule) |
| 7 | +AlarmRuleDefinition getAlarmRuleById(@Nonnull String alarmRuleId) // Get Alarm Rule (getAlarmRuleById) |
| 8 | +PageDataString getAlarmRuleNames(@Nonnull Integer pageSize, @Nonnull Integer page, @Nullable String textSearch, @Nullable String sortOrder) // Get alarm rule names (getAlarmRuleNames) |
| 9 | +PageDataAlarmRuleDefinitionInfo getAlarmRules(@Nonnull Integer pageSize, @Nonnull Integer page, @Nullable EntityType entityType, @Nullable Set<UUID> entities, @Nullable String textSearch, @Nullable String sortProperty, @Nullable String sortOrder) // Get alarm rules (getAlarmRules) |
| 10 | +PageDataAlarmRuleDefinition getAlarmRulesByEntityId(@Nonnull String entityType, @Nonnull String entityId, @Nonnull Integer pageSize, @Nonnull Integer page, @Nullable String textSearch, @Nullable String sortProperty, @Nullable String sortOrder) // Get Alarm Rules by Entity Id (getAlarmRulesByEntityId) |
| 11 | +com.fasterxml.jackson.databind.JsonNode getLatestAlarmRuleDebugEvent(@Nonnull String alarmRuleId) // Get latest alarm rule debug event (getLatestAlarmRuleDebugEvent) |
| 12 | +AlarmRuleDefinition saveAlarmRule(@Nonnull AlarmRuleDefinition alarmRuleDefinition) // Create Or Update Alarm Rule (saveAlarmRule) |
| 13 | +com.fasterxml.jackson.databind.JsonNode testAlarmRuleScript(@Nonnull Object body) // Test alarm rule TBEL expression (testAlarmRuleScript) |
| 14 | +``` |
| 15 | + |
| 16 | + |
| 17 | +## deleteAlarmRule |
| 18 | + |
| 19 | +``` |
| 20 | +void deleteAlarmRule(@Nonnull String alarmRuleId) |
| 21 | +``` |
| 22 | + |
| 23 | +**DELETE** `/api/alarm/rule/{alarmRuleId}` |
| 24 | + |
| 25 | +Delete Alarm Rule (deleteAlarmRule) |
| 26 | + |
| 27 | +Deletes the alarm rule. Referencing non-existing Alarm Rule Id will cause an error. Available for users with 'TENANT_ADMIN' authority. |
| 28 | + |
| 29 | + |
| 30 | +### Parameters |
| 31 | + |
| 32 | +| Name | Type | Description | Notes | |
| 33 | +|------------- | ------------- | ------------- | -------------| |
| 34 | +| **alarmRuleId** | **String** | | | |
| 35 | + |
| 36 | +### Return type |
| 37 | + |
| 38 | +null (empty response body) |
| 39 | + |
| 40 | + |
| 41 | +## getAlarmRuleById |
| 42 | + |
| 43 | +``` |
| 44 | +AlarmRuleDefinition getAlarmRuleById(@Nonnull String alarmRuleId) |
| 45 | +``` |
| 46 | + |
| 47 | +**GET** `/api/alarm/rule/{alarmRuleId}` |
| 48 | + |
| 49 | +Get Alarm Rule (getAlarmRuleById) |
| 50 | + |
| 51 | +Fetch the Alarm Rule object based on the provided Alarm Rule Id. Available for users with 'TENANT_ADMIN' authority. |
| 52 | + |
| 53 | + |
| 54 | +### Parameters |
| 55 | + |
| 56 | +| Name | Type | Description | Notes | |
| 57 | +|------------- | ------------- | ------------- | -------------| |
| 58 | +| **alarmRuleId** | **String** | | | |
| 59 | + |
| 60 | +### Return type |
| 61 | + |
| 62 | +**AlarmRuleDefinition** |
| 63 | + |
| 64 | + |
| 65 | +## getAlarmRuleNames |
| 66 | + |
| 67 | +``` |
| 68 | +PageDataString getAlarmRuleNames(@Nonnull Integer pageSize, @Nonnull Integer page, @Nullable String textSearch, @Nullable String sortOrder) |
| 69 | +``` |
| 70 | + |
| 71 | +**GET** `/api/alarm/rules/names` |
| 72 | + |
| 73 | +Get alarm rule names (getAlarmRuleNames) |
| 74 | + |
| 75 | +Fetch the list of alarm rule names. Available for users with 'TENANT_ADMIN' authority. |
| 76 | + |
| 77 | + |
| 78 | +### Parameters |
| 79 | + |
| 80 | +| Name | Type | Description | Notes | |
| 81 | +|------------- | ------------- | ------------- | -------------| |
| 82 | +| **pageSize** | **Integer** | Maximum amount of entities in a one page | | |
| 83 | +| **page** | **Integer** | Sequence number of page starting from 0 | | |
| 84 | +| **textSearch** | **String** | The case insensitive 'substring' filter based on the calculated field name. | [optional] | |
| 85 | +| **sortOrder** | **String** | Sort order. ASC (ASCENDING) or DESC (DESCENDING) | [optional] [enum: ASC, DESC] | |
| 86 | + |
| 87 | +### Return type |
| 88 | + |
| 89 | +**PageDataString** |
| 90 | + |
| 91 | + |
| 92 | +## getAlarmRules |
| 93 | + |
| 94 | +``` |
| 95 | +PageDataAlarmRuleDefinitionInfo getAlarmRules(@Nonnull Integer pageSize, @Nonnull Integer page, @Nullable EntityType entityType, @Nullable Set<UUID> entities, @Nullable String textSearch, @Nullable String sortProperty, @Nullable String sortOrder) |
| 96 | +``` |
| 97 | + |
| 98 | +**GET** `/api/alarm/rules` |
| 99 | + |
| 100 | +Get alarm rules (getAlarmRules) |
| 101 | + |
| 102 | +Fetch tenant alarm rules based on the filter. Available for users with 'TENANT_ADMIN' authority. |
| 103 | + |
| 104 | + |
| 105 | +### Parameters |
| 106 | + |
| 107 | +| Name | Type | Description | Notes | |
| 108 | +|------------- | ------------- | ------------- | -------------| |
| 109 | +| **pageSize** | **Integer** | Maximum amount of entities in a one page | | |
| 110 | +| **page** | **Integer** | Sequence number of page starting from 0 | | |
| 111 | +| **entityType** | **EntityType** | Entity type filter. If not specified, alarm rules for all supported entity types will be returned. | [optional] [enum: TENANT, CUSTOMER, USER, DASHBOARD, ASSET, DEVICE, ALARM, RULE_CHAIN, RULE_NODE, ENTITY_VIEW, WIDGETS_BUNDLE, WIDGET_TYPE, TENANT_PROFILE, DEVICE_PROFILE, ASSET_PROFILE, API_USAGE_STATE, TB_RESOURCE, OTA_PACKAGE, EDGE, RPC, QUEUE, NOTIFICATION_TARGET, NOTIFICATION_TEMPLATE, NOTIFICATION_REQUEST, NOTIFICATION, NOTIFICATION_RULE, QUEUE_STATS, OAUTH2_CLIENT, DOMAIN, MOBILE_APP, MOBILE_APP_BUNDLE, CALCULATED_FIELD, JOB, ADMIN_SETTINGS, AI_MODEL, API_KEY] | |
| 112 | +| **entities** | **Set<UUID>** | Entities filter. If not specified, alarm rules for entity type filter will be returned. | [optional] | |
| 113 | +| **textSearch** | **String** | The case insensitive 'substring' filter based on the calculated field name. | [optional] | |
| 114 | +| **sortProperty** | **String** | Property of entity to sort by | [optional] [enum: createdTime, name] | |
| 115 | +| **sortOrder** | **String** | Sort order. ASC (ASCENDING) or DESC (DESCENDING) | [optional] [enum: ASC, DESC] | |
| 116 | + |
| 117 | +### Return type |
| 118 | + |
| 119 | +**PageDataAlarmRuleDefinitionInfo** |
| 120 | + |
| 121 | + |
| 122 | +## getAlarmRulesByEntityId |
| 123 | + |
| 124 | +``` |
| 125 | +PageDataAlarmRuleDefinition getAlarmRulesByEntityId(@Nonnull String entityType, @Nonnull String entityId, @Nonnull Integer pageSize, @Nonnull Integer page, @Nullable String textSearch, @Nullable String sortProperty, @Nullable String sortOrder) |
| 126 | +``` |
| 127 | + |
| 128 | +**GET** `/api/alarm/rules/{entityType}/{entityId}` |
| 129 | + |
| 130 | +Get Alarm Rules by Entity Id (getAlarmRulesByEntityId) |
| 131 | + |
| 132 | +Fetch the Alarm Rules based on the provided Entity Id. Available for users with 'TENANT_ADMIN' authority. |
| 133 | + |
| 134 | + |
| 135 | +### Parameters |
| 136 | + |
| 137 | +| Name | Type | Description | Notes | |
| 138 | +|------------- | ------------- | ------------- | -------------| |
| 139 | +| **entityType** | **String** | A string value representing the entity type. For example, 'DEVICE' | | |
| 140 | +| **entityId** | **String** | A string value representing the entity id. For example, '784f394c-42b6-435a-983c-b7beff2784f9' | | |
| 141 | +| **pageSize** | **Integer** | Maximum amount of entities in a one page | | |
| 142 | +| **page** | **Integer** | Sequence number of page starting from 0 | | |
| 143 | +| **textSearch** | **String** | The case insensitive 'substring' filter based on the calculated field name. | [optional] | |
| 144 | +| **sortProperty** | **String** | Property of entity to sort by | [optional] [enum: createdTime, name] | |
| 145 | +| **sortOrder** | **String** | Sort order. ASC (ASCENDING) or DESC (DESCENDING) | [optional] [enum: ASC, DESC] | |
| 146 | + |
| 147 | +### Return type |
| 148 | + |
| 149 | +**PageDataAlarmRuleDefinition** |
| 150 | + |
| 151 | + |
| 152 | +## getLatestAlarmRuleDebugEvent |
| 153 | + |
| 154 | +``` |
| 155 | +com.fasterxml.jackson.databind.JsonNode getLatestAlarmRuleDebugEvent(@Nonnull String alarmRuleId) |
| 156 | +``` |
| 157 | + |
| 158 | +**GET** `/api/alarm/rule/{alarmRuleId}/debug` |
| 159 | + |
| 160 | +Get latest alarm rule debug event (getLatestAlarmRuleDebugEvent) |
| 161 | + |
| 162 | +Gets latest alarm rule debug event for specified alarm rule id. Referencing non-existing alarm rule id will cause an error. Available for users with 'TENANT_ADMIN' authority. |
| 163 | + |
| 164 | + |
| 165 | +### Parameters |
| 166 | + |
| 167 | +| Name | Type | Description | Notes | |
| 168 | +|------------- | ------------- | ------------- | -------------| |
| 169 | +| **alarmRuleId** | **String** | | | |
| 170 | + |
| 171 | +### Return type |
| 172 | + |
| 173 | +**com.fasterxml.jackson.databind.JsonNode** |
| 174 | + |
| 175 | + |
| 176 | +## saveAlarmRule |
| 177 | + |
| 178 | +``` |
| 179 | +AlarmRuleDefinition saveAlarmRule(@Nonnull AlarmRuleDefinition alarmRuleDefinition) |
| 180 | +``` |
| 181 | + |
| 182 | +**POST** `/api/alarm/rule` |
| 183 | + |
| 184 | +Create Or Update Alarm Rule (saveAlarmRule) |
| 185 | + |
| 186 | +Creates or Updates the Alarm Rule. When creating alarm rule, platform generates Alarm Rule Id as [time-based UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_(date-time_and_MAC_address)). The newly created Alarm Rule Id will be present in the response. Specify existing Alarm Rule Id to update the alarm rule. Referencing non-existing Alarm Rule Id will cause 'Not Found' error. Remove 'id', 'tenantId' from the request body example (below) to create new Alarm Rule entity. Available for users with 'TENANT_ADMIN' authority. |
| 187 | + |
| 188 | + |
| 189 | +### Parameters |
| 190 | + |
| 191 | +| Name | Type | Description | Notes | |
| 192 | +|------------- | ------------- | ------------- | -------------| |
| 193 | +| **alarmRuleDefinition** | **AlarmRuleDefinition** | A JSON value representing the alarm rule. | | |
| 194 | + |
| 195 | +### Return type |
| 196 | + |
| 197 | +**AlarmRuleDefinition** |
| 198 | + |
| 199 | + |
| 200 | +## testAlarmRuleScript |
| 201 | + |
| 202 | +``` |
| 203 | +com.fasterxml.jackson.databind.JsonNode testAlarmRuleScript(@Nonnull Object body) |
| 204 | +``` |
| 205 | + |
| 206 | +**POST** `/api/alarm/rule/testScript` |
| 207 | + |
| 208 | +Test alarm rule TBEL expression (testAlarmRuleScript) |
| 209 | + |
| 210 | +Execute the alarm rule TBEL condition expression and return the result. Alarm rule expressions must return a boolean value. The format of request: ```json { \"expression\": \"return temperature > 50;\", \"arguments\": { \"temperature\": { \"type\": \"SINGLE_VALUE\", \"ts\": 1739776478057, \"value\": 55 } } } ``` Expected result JSON contains \"output\" and \"error\". Available for users with 'TENANT_ADMIN' authority. |
| 211 | + |
| 212 | + |
| 213 | +### Parameters |
| 214 | + |
| 215 | +| Name | Type | Description | Notes | |
| 216 | +|------------- | ------------- | ------------- | -------------| |
| 217 | +| **body** | **Object** | Test alarm rule TBEL condition expression. The expression must return a boolean value. | | |
| 218 | + |
| 219 | +### Return type |
| 220 | + |
| 221 | +**com.fasterxml.jackson.databind.JsonNode** |
| 222 | + |
0 commit comments