Skip to content

Update Alerts

Update the specified alerts. If clearedAt is specified, isCleared will be set to true. If isCleared is set to true and clearedAt is null or not present, it will be set to the UTC server time that this request is processed.

Only clearedAt, isCleared, and message will be updated. Alerts cannot be uncleared.

Verb PATCH
Endpoint {base-url}/alerts
Max Page Size N/A

Request Body

{
  "body": [
    {
      "id": 36579,
      "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"
    }
  ]
}

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

Returns the updated alerts.

Response Body

[
  {
    "id": 36579,
    "accountId": 161,
    "siteId": 477,
    "organizationId": 12,
    "machineLocation": "Lunchroom - Soda",
    "machineProse": null,
    "machineId": 1402,
    "code": "NS",
    "alertCodeId": 7,
    "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": [],
    "timeZone": "America/Chicago"
  }
]

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. These fields are validated on update but ignored: only clearedAt, isCleared, and message are written.
403 DATA_ACCESS_VIOLATION One or more of the specified alert id values belong to an organization the requester does not have access to.
404 MISSING_RECORD One or more of the specified alert id values does not exist.