[comment]: # translation:outdated

[comment]: # ({3ab1bd41-be70f0cc})
# 更新

[comment]: # ({/3ab1bd41-be70f0cc})

[comment]: # ({1f93aa5e-b9c51452})
### 说明

`object triggerprototype.update(object/array triggerPrototypes)`

此方法允许更新已有的触发器原型。

[comment]: # ({/1f93aa5e-b9c51452})

[comment]: # ({2fdfa499-827e4920})
### 参数

`(object/array)`需要更新的触发器原型[Trigger prototype
properties](object#trigger_prototype)。
`triggerid`属性必须在每个触发器原型中已定义，其他所有属性为可选项。只有传递过去的属性会被更新，其他所有属性仍然保持不变。
除[standard trigger prototype
properties](object#trigger_prototype)之外，该方法接受以下参数。

|参数           类|说明|<|
|--------------------|------|-|
|dependencies|array|依赖触发器原型的触发器和触发器原型。<br><br>触发器必须已定义`triggerid`属性。|
|tags|array|触发器标签。|

<note
important>指定的触发器表达式必须为展开式，并且必须包含至少一个监控项原型。
:::

[comment]: # ({/2fdfa499-827e4920})

[comment]: # ({7e48970e-200d7b9d})
### 返回值

`(object)`返回一个对象，该对象包含在`triggerids`属性中已更新触发器原型的ID。

[comment]: # ({/7e48970e-200d7b9d})

[comment]: # ({392bbd85-b41637d2})
### 范例

[comment]: # ({/392bbd85-b41637d2})

[comment]: # ({6a156134-bcca41dc})
#### 启用触发器原型

启用一个触发器原型，即将其状态设置为0。

请求:

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

响应:

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

[comment]: # ({/6a156134-bcca41dc})

[comment]: # ({90ccd187-724af3ce})
#### 替换触发器原型标签

为触发器原型替换标签。

请求:

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

响应:

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

[comment]: # ({/90ccd187-724af3ce})

[comment]: # ({f385dc7f-585ae96a})
### 源码

CTriggerPrototype::update()方法可在*frontends/php/include/classes/api/services/CTriggerPrototype.php*中参考。

[comment]: # ({/f385dc7f-585ae96a})
