Skip to main content

updateClosedAlert

A MoogDb v2 method that updates the description and custom info of a closed alert during the grace period. The grace period is when an alert is closed and in the active database, before it is archived to the historic database. If a custom info field already exists, this method replaces the previous value; if the custom info field does not exist, this method adds it.

The updateClosedAlert method returns an error if the alert is open, or if it is closed and has been archived to the historic database.

Back to MoogDb V2 API Method Reference.

Request arguments

Method updateClosedAlert takes the following request arguments:

Name

Type

Required

Description

alert_id

Number

Yes

ID of the closed alert that you want to update.

description

String

No

New description of the alert.

custom_info

JSON Object

No

A JSON object containing the custom info values that you want to update. If the key already exists, the method replaces the existing value. If the key does not exist, the method adds it.

Response

Method updateClosedAlert returns the following response:

API update behavior

The behavior of this method depends on whether the relevant alert or Situation is open, closed and still in the active database, or closed and archived to the historic database. This method updates or returns information about the alert or Situation as follows:

See API Update Behavior for more information on Situation statuses.

Examples

The following examples demonstrate typical use of method updateClosedAlert:

Request example

Example request to update the description and custom info for alert ID 9:

function updateClosedAlert1()
{
   var obtainAlert=moogdb.getAlert(9);
   var customInfo={"key1":"value1"};
   obtainAlert.set("description", "updateClosedAlert1_description_updated");
   obtainAlert.set("custom_info", customInfo);
   var result=moogdb.updateClosedAlert(obtainAlert);
   logger.warning("system updates alert which is in grace period, result should return true");
   logger.warning("result = "+ result);
}

Response example