trigger.update
Description说明
object trigger.update(object/array triggers)
This method allows to update existing triggers此方法用于更新目前的触发器.
Parameters参数
(object/array)
Trigger properties to be updated需要被更新的触发器属性.
The triggerid
property must be defined for each trigger, all other properties are optional. Only the passed properties will be updated, all others will remain unchanged.triggerid
属性必须在每个应用集中已定义,其他所有属性为可选项。只有传递过去的属性会被更新,其他所有属性仍然保持不变。
Additionally to the standard trigger properties the method accepts the following parameters除 standard trigger properties之外,该方法接受以下参数。.
Parameter参数 | Type类型 | Description说明 |
---|---|---|
dependencies | array | Triggers that the trigger is dependent on触发触发器依赖. The triggers must have the triggerid property defined触发器必须定义triggerid 属性. |
tags | array | Trigger tags触发器标签. |
The trigger expression has to be given in its expanded form触发器表达式必须以其扩展形式给出.
Return values返回值
(object)
Returns an object containing the IDs of the updated triggers under the triggerids
property.(object)
返回一个triggerids
属性下已更新应用集的ID的对象
Examples范例
Enabling a trigger启用触发器
Enable a trigger, that is, set its status to 0.启用触发器,即将其状态设置为0。
Request请求:
- {
- "jsonrpc": "2.0",
- "method": "trigger.update",
- "params": {
- "triggerid": "13938",
- "status": 0
- },
- "auth": "038e1d7b1735c6a5436ee9eae095879e",
- "id": 1
- }
Response响应:
- {
- "jsonrpc": "2.0",
- "result": {
- "triggerids": [
- "13938"
- ]
- },
- "id": 1
- }
Replacing triggers tags替换触发器标签
Replace tags for trigger替换触发器的标签.
Request请求:
- {
- "jsonrpc": "2.0",
- "method": "trigger.update",
- "params": {
- "triggerid": "13938",
- "tags": [
- {
- "tag": "service",
- "value": "{{ITEM.VALUE}.regsub(\"Service (.*) has stopped\", \"\\1\")}"
- },
- {
- "tag": "error",
- "value": ""
- }
- ]
- },
- "auth": "038e1d7b1735c6a5436ee9eae095879e",
- "id": 1
- }
Response响应:
- {
- "jsonrpc": "2.0",
- "result": {
- "triggerids": [
- "13938"
- ]
- },
- "id": 1
- }
See also参见
Source来源
CTrigger::update() in frontends/php/include/classes/api/services/CTrigger.php.