[comment]: # ({be70f0cc-be70f0cc})
### # triggerprototype.update

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

[comment]: # ({0af53e19-842b5955})
### 描述

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

此方法用于update现有的触发器原型。

::: noteclassic
此方法仅适用于*Admin*和*Super admin*用户类型。调用该方法的权限可以在用户角色设置中撤销。更多信息请参见[User
roles](/manual/web_interface/frontend_sections/users/user_roles)。
:::

[comment]: # ({/0af53e19-842b5955})

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

`(object/array)` 要更新的触发器原型属性。

每个触发器原型都必须定义 `triggerid` 属性，其他所有属性均为可选。只有传入的属性会被更新，其余属性将保持不变。

除了[标准触发器原型属性](object#trigger-prototype)之外，该方法还接受以下参数。

|Parameter|[Type](/manual/api/reference_commentary#data-types)|Description|
|--|--|------|
|dependencies|array|该触发器原型所依赖的[触发器](/manual/api/reference/trigger/object#trigger)和[触发器原型](/manual/api/reference/triggerprototype/object#trigger-prototype)。<br><br>这些触发器只能定义 `triggerid` 属性。|
|tags|array|[触发器原型标签](/manual/api/reference/triggerprototype/object#trigger-prototype-tag)。|

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

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

`(object)` 返回一个 object，其中包含更新后的触发器原型的 ID，这些 ID 位于 `triggerids` 属性下。

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

[comment]: # ({b41637d2-b41637d2})
### 示例

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

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

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

[执行请求](/manual/api#执行请求):


```json
{
    "jsonrpc": "2.0",
    "method": "triggerprototype.update",
    "params": {
        "triggerid": "13938",
        "status": 0
    },
    "id": 1
}
```
响应：


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

[comment]: # ({/7b2a44a5-bcca41dc})

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

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

[执行请求](/manual/api#执行请求):


```json
{
    "jsonrpc": "2.0",
    "method": "triggerprototype.update",
    "params": {
        "triggerid": "17373",
        "tags": [
            {
                "tag": "volume",
                "value": "{#FSNAME}"
            },
            {
                "tag": "type",
                "value": "{#FSTYPE}"
            }
        ]
    },
    "id": 1
}
```
响应：


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

[comment]: # ({/708ac736-724af3ce})

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

CTriggerPrototype::update() 函数位于
*ui/include/classes/api/services/CTriggerPrototype.php* 文件中。

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