Create Alerts
Create the specified alerts.
| Verb | PUT |
|---|---|
| Endpoint | {base-url}/alerts |
| Max Page Size | N/A |
Request Body
{
"body": [
{
"organizationId": 12,
"accountId": 161,
"siteId": 477,
"machineLocation": "Lunchroom - Soda",
"machineProse": null,
"machineId": 1402,
"alertCodeId": 7,
"code": "NS",
"message": "No Sales have been reported by this machine for at least 3 day(s).",
"isCleared": false,
"clearedAt": null,
"raisedAt": "2021-03-29T15:56:41.677",
"alertMetadata": [
{
"key": "sensorId",
"value": "TEMP-3"
}
]
}
]
}
Note
All changes in this request are atomic. If any item fails, the entire batch is rolled back and no changes are made.
Returns
On Success
Return a list of the IDs of the created alerts.
Response Body
[
36579
]
On Error
| HTTP Code | Error Code | Definition |
|---|---|---|
| 400 | DESERIALIZATION_ERROR | Request body was empty or missing. |
| 422 | VALIDATION_ERROR | organizationId, machineId, alertCodeId, or raisedAt is missing or invalid. |
| 422 | VALIDATION_ERROR | alertMetadata.key exceeds 200 characters, or alertMetadata.key or alertMetadata.value is missing or empty. |
| 422 | VALIDATION_ERROR | One or more alerts were marked as cleared but no clearedAt timestamp was provided. |
| 422 | DATA_VALIDATION_ERROR | One or more alerts referenced an alert code that does not exist. Dynamic alert codes are not supported. |
| 422 | INVALID_ALERT | One or more alerts referenced an alert code that could not be retrieved; dynamic alert codes are unsupported. |
| 403 | DATA_ACCESS_VIOLATION | One or more alerts reference an organizationId you don't own, or a machineId owned by another organization. |
| 404 | MISSING_RECORD | One or more alerts reference a machineId that does not exist. |