update_notification
The update_notification function is used to create, edit, or delete notifications.
svc = "resource/update_notification"
params = {
"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>, // Max time interval between messages (sec)
"cdt": <uint>, // Alarm timeout (sec)
"mast": <uint>, // Min duration of alarm state (sec)
"mpst": <uint>, // Min duration of previous state (sec)
"cp": <uint>, // Control period relative to current time (sec)
"fl": <uint>, // Notification flags
"tz": <int>, // Time zone
"la": "<text>", // User language (2-letter code)
"un": [<long>], // Array of unit or unit group IDs
"sch": { // Notification schedule
"f1": <uint>, // Interval 1 start (minutes from midnight)
"f2": <uint>, // Interval 2 start (minutes from midnight)
"t1": <uint>, // Interval 1 end (minutes from midnight)
"t2": <uint>, // Interval 2 end (minutes from midnight)
"m": <uint>, // Day-of-month mask
"y": <uint>, // Month mask
"w": <uint> // Day-of-week mask
},
"ctrl_sch": { // Max alarms control schedule
"f1": <uint>,
"f2": <uint>,
"t1": <uint>,
"t2": <uint>,
"m": <uint>,
"y": <uint>,
"w": <uint>
},
"trg": { // Trigger
"t": "<text>",
"p": {
"<text>": "<text>",
...
}
},
"act": [ // Actions
{
"t": "<text>", // Action type
"p": {
"<text>": "<text>", // Parameters
...
}
}
]
}
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. |