triggerprototype.update

说明

object triggerprototype.update(object/array triggerPrototypes)

此方法用于更新目前的触发器原型。

参数

(object/array) 需要被更新的触发器原型属性Trigger prototype properties

triggerid 属性必须在每个触发器原型中定义,其他所有属性为可选项。只有传递过去的属性会被更新,其他所有属性仍然保持不变。

standard trigger prototype properties 之外,该方法接受以下参数。

参数 类 说明
dependencies array 触发器原型依赖的触发器和触发器原型。

触发器必须定义 triggerid 属性。
tags array 触发器原型标签。

<note important>触发器表达式必须以扩展形式给定,并且必须包含至少一个项目原型。 :::

返回值

(object) 返回一个 triggerids 属性下已更新触发器原型的ID的对象。

范例

启用触发器原型

启用触发器,即将其状态设置为0。

请求:

{
    "jsonrpc": "2.0",
    "method": "triggerprototype.update",
    "params": {
        "triggerid": "13938",
        "status": 0
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}

Response:

{
    "jsonrpc": "2.0",
    "result": {
        "triggerids": [
            "13938"
        ]
    },
    "id": 1
}

替换触发器原型标签

为一个触发器原型替换标签。

请求:

{
    "jsonrpc": "2.0",
    "method": "triggerprototype.update",
    "params": {
        "triggerid": "17373",
        "tags": [
            {
                "tag": "volume",
                "value": "{#FSNAME}"
            },
            {
                "tag": "type",
                "value": "{#FSTYPE}"
            }
        ]
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}

响应:

{
    "jsonrpc": "2.0",
    "result": {
        "triggerids": [
            "17373"
        ]
    },
    "id": 1
}

来源

CTriggerPrototype::update() in frontends/php/include/classes/api/services/CTriggerPrototype.php.