update_notification
The update_notification function is used to create, edit, or delete notifications.
svc=resource/update_notification¶ms={"itemId":<long>,
"id":<long>, /* notification ID */
"callMode":"<text>",
"e":<uint>,
"n":"<text>", /* name */
"txt":"<text>", /* notification text */
"ta":<uint>, /* activation time (Unix format) */
"td":<uint>, /* deactivation time (Unix format) */
"ma":<uint>, /* maximum number of alarms (0 — unlimited) */
"mmtd":<uint>, /* maximum time interval between messages, s */
"cdt":<uint>, /* timeout of alarm, sec */
"mast":<uint>, /* minimum duration of the alarm state, s */
"mpst":<uint>, /* minimum duration of previous state, s */
"cp":<uint>, /* period of control relative to current time, s */
"fl":<uint>, /* notification flags (see below) */
"tz":<int>, /* time zone */
"la":"<text>", /* user language (two-letter code) */
"un":[<long>], /* array of IDs of units/unit groups */
"sch":{
"f1":<uint>, /* the beginning of the interval 1 (minutes from midnight) */
"f2":<uint>, /* the beginning of the interval 2 (minutes from midnight) */
"t1":<uint>, /* the end of the interval 1 (minutes from midnight) */
"t2":<uint>, /* the end of the interval 2 (minutes from midnight) */
"m":<uint>, /* the mask of days of month [1: 2||0, 31: 2||30] */
"y":<uint>, /* the mask of months [Jan: 2||0, Dec: 2||11] */
"w":<uint> /* the mask of days of week [Mon: 2||0, Sun: 2||6] */
},
"ctrl_sch":{ /* the schedule of maximum alarms count intervals */
"f1":<uint>, /* the beginning of the interval 1 (minutes from midnight) */
"f2":<uint>, /* the beginning of the interval 2 (minutes from midnight) */
"t1":<uint>, /* the end of the interval 1 (minutes from midnight) */
"t2":<uint>, /* the end of the interval 2 (minutes from midnight) */
"m":<uint>, /* the mask of days of month [1: 2||0, 31: 2||30] */
"y":<uint>, /* the mask of months [Jan: 2||0, Dec: 2||11] */
"w":<uint> /* the mask of days of week [Mon: 2||0, Sun: 2||6] */
},
"trg":{
"t":"<text>",
"p":{
"<text>":"<text>",
...
}
},
"act":[ /* actions */
{
"t":"<text>", /* action type, see below */
"p":{ /* parameters */
"<text>":"<text>", /* parameter name: value */
...
}
}
]}
See notifications flag and action type description on the get_notification_data page.
For notifications of the Off time control type, the value of the mast parameter specified in seconds must correspond to the value of the min_idle_time parameter specified in minutes. Thus, if you want the notification to be triggered after 10 minutes of off time, specify 10 for min_idle_time and 600 for mast.
Parameters
Name | Description |
---|---|
itemId | Resource ID. |
id | Notification ID (0 — create). |
callMode | Action: create, edit, delete, enable. |
e | Is used only for the "enable" callMode:
|
Other parameters are only required for creating and updating. See the get_notification_data page.
Returned result
For creation and modification requests:
[
<long>, /* notification ID */
{
"id":<long>, /* notification ID */
"n":"<text>", /* name */
"txt":"<text>", /* notification text */
"ta":<uint>, /* activation time (Unix format) */
"td":<uint>, /* deactivation time (Unix format) */
"ma":<uint>, /* maximum alarms count (0 — unlimited) */
"fl":<uint>, /* notification flags */
"ac":<uint>, /* execution count */
"un":[<long>], /* array of units/unit group IDs */
"act":["<text>"], /* actions */
"trg":"<text>", /* control type */
"trg_p":{}, /* control settings */
"crc":<long>, /* check sum of binary representation of notification */
"ct":<uint>, /* creation time */
"mt":<uint> /* last modification time */
}
]
Notification flags, action, and control types are described here.
For deletion requests:
[
<long>, /* notification ID */
null
]
Possible error codes:
Code | Description |
---|---|
7 | Failed to fetch the resource with the desired ACL (ADF_ACL_AVL_RES_EDIT_NF). |
6 | Undefined error. |
4 | Wrong input parameters. |