Update a Trigger for Anomaly Detection
# Update a Trigger for Anomaly Detection ### `PUT /v2/triggers` Updating a trigger for anomaly detection is similar to updating any trigger in Connectivity Management. The only difference is a few new values added for Anomaly Detection. This page will cover the new values and provide examples of what requests look like with the new values. The API Reference page for updating a trigger can be found at [Update a Trigger](https://thingspace.verizon.com/documentation/api-documentation.html#/http/connectivity-management/guides/uses-and-requirements/update-a-trigger). ## HTTP Request PUT [https://thingspace.verizon.com/api/m2m/v2/triggers](/docs/premium-apis/thingspace-intelligence/api-endpoints/anomaly-triggers-v2/updateanomalydetectiontriggerv2) ## Request Parameters All parameters are required unless marked "optional". | Parameter Name | Data Type | Description | |:-----------------------------------------------------------------------------------|:---------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | **triggerId** *(required)* | string | The system assigned name of the trigger being updated | | **triggerName** | string | The user defined name of the trigger | | **triggerCategory** *(required)* | string | `UsageAnomaly` - This is the value to use in the request body to detect anomalous behaivior. The values in this table will only be relevant when this parameter is set to this value. | | **accountName** *(required)* | string | The name of a billing account. An account name is usually numeric, and must include any leading zeros. | | **anomalyTriggerRequest** | object | The details of the `UsageAnomaly` trigger. | | **anomalyTriggerRequest.accountNames** <br> *(either accountNames or deviceGroup is required)* | string | The Verizon billing account associated with the anomaly triggers for this trigger to be active for devices in those accounts. This should match the `accountName` parameter from above.<br> An account name is usually numeric, and must include any leading zeros. | | **anomalyTriggerRequest.deviceGroups** <br> *(either accountNames or deviceGroup is required)* | string | The names of device groups associated with the anomaly triggers for this trigger to be active for devices in those groups. | | **anomalyTriggerRequest.includeAbnormal** *(required)* | boolean | Whether or not to include anomalies classified as “abnormal". `true` or `false`. <br> Classification is set as part of ThingSpace Intelligence anomaly detection settings. | | **anomalyTriggerRequest.includeVeryAbnormal** <br> *(required)* | boolean | Whether or not to include anomalies classified as “very abnormal”. `true` or `false`. <br> Classification is set as part of ThingSpace Intelligence anomaly detection settings. | | **anomalyTriggerRequest.includeUnderExpectedUsage** <br> *(required)* | boolean | Whether or not to include anomalies that are directionally under the expected usage. `true` or `false`. | | **anomalyTriggerRequest.includeOverExpectedUsage** <br> *(required)* | boolean | Whether or not to include anomalies that are directionally over the expected usage. `true` or `false`. | | **notification** | object | The notification details of the trigger. | | **notification.notificationType** *(required)* | string | The type of notification, i.e. "DailySummary". | | **notification.callback** *(required)* | boolean | Whether or not the notification should be sent via callback. `true` or `false`. | | **notification.emailNotification** *(required)* | boolean | Whether or not the notification should be sent via e-mail. `true` or `false`. | | **notification.notificationGroupName** | string | Name for the notification group | | **notification.notificationFrequencyFactor** | integer | how often notifications will occur once the threshold is met | | **notification.notificationFrequencyInterval** | integer | How much time between notifications | | **notification.externalEmailRecipients** <br> *(required when emailNotification = true)* | string | E-mail address(es) where the notification should be delivered. | | **notification.smsNotification** | boolean | If notifications will be sent out as SMS messages to cellphones. <br> `True` - SMS messages will be sent, `False` - SMS messages will not be sent | | **notification.smsNumbers** | string | A comma seperated list of 10-digit cellphone numbers to send notifications to. | | **notification.reminder** | boolean | If a daily reminder from the trigger will be sent regardless of the threshold being met or not. <br> `True` - Send a daily reminder, `False` - No reminder will be sent. | | **notification.severity** | string | Severity level associated with the notification. Examples would be: Major Minor Critical NotApplicable | | **active** | boolean | Indicates if the trigger is active or not. `True` - Trigger is active, `False` - Trigger is not active. | ## Example Request Update a trigger for an Anomaly Detection alert ``` json { "triggerId":"595f5c44-c31c-4552-8670-020a1545a84d", "triggerName":"Anomaly Daily Usage REST Test-Patch Update 4", "accountName":"0000123456-00001", "triggerCategory":"UsageAnomaly", "anomalyTriggerRequest":{ "accountNames":["0000123456-00001"], "includeAbnormal":true, "includeVeryAbnormal":true, "includeUnderExpectedUsage":false, "includeOverExpectedUsage":true }, "notification":{ "notificationType":"DailySummary", "callback":true, "emailNotification":false, "notificationGroupName":"Anomaly Test API", "notificationFrequencyFactor":3, "notificationFrequencyInterval":"20", "externalEmailRecipients":"placeholder@verizon.com", "smsNotification":true, "smsNumbers":"10-digit cellphone number", "reminder":true, "severity":"Critical" }, "active":true } ``` ## Success Responses A successful request will return a trigger ID to identify the request in a callback. For more information about callbacks, please visit [About Callback Services](https://thingspace.verizon.com/documentation/api-documentation.html#/http/connectivity-management/guides/working-with-verizon-wireless/about-callback-services).. Status 200 A successful response shows a system generated request ID to track the request. ``` json { "status": "Success", } ``` ## Failure Responses All error responses will be in the following format ``` json { "errorCode": "error code string", "errorMessage": "error message string" } ``` ## Callback Response Example of a callback for an updated trigger: ``` json { "triggerId":"595f5c44-c31c-4552-8670-020a1545a84d", "triggerName":"Usage Anomaly DG Level -R8", "accountName":"0000123456-00001", "triggerCategory":"UsageAnomaly", "anomalyTriggerRequest":{ "deviceGroup": "Default: 0000123456-00001", "includeAbnormal":false, "includeVeryAbnormal":true, "includeUnderExpectedUsage":false, "includeOverExpectedUsage":true }, "notification":{ "notificationType":"DailySummary", "callback":true, "emailNotification":true, "notificationGroupName":"Anomaly Test API", "externalEmailRecipients":"placeholder@verizon.com", "severity":"NotApplicable" }, "active":true } ```