[comment]: # ({a7557797-a7557797})
# trigger.update

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

[comment]: # ({684473f9-684473f9})
### Description

`object trigger.update(object/array triggers)`

This method allows to update existing triggers.

[comment]: # ({/684473f9-684473f9})

[comment]: # ({a40f63c4-a40f63c4})
### 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.

Additionally to the [standard trigger properties](object#trigger) the
method accepts the following parameters.

|Parameter|[Type](/manual/api/reference_commentary#data_types)|Description|
|---------|---------------------------------------------------|-----------|
|dependencies|array|Triggers that the trigger is dependent on.<br><br>The triggers must have the `triggerid` property defined.|
|tags|array|Trigger tags.|

::: noteimportant
The trigger expression has to be given in its
expanded form.
:::

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

[comment]: # ({18d0cc04-18d0cc04})
### Return values

`(object)` Returns an object containing the IDs of the updated triggers
under the `triggerids` property.

[comment]: # ({/18d0cc04-18d0cc04})

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

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

[comment]: # ({07c64481-07c64481})
#### Enabling a trigger

Enable a trigger, that is, set its status to 0.

Request:

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

Response:

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

[comment]: # ({/07c64481-07c64481})

[comment]: # ({b2bab7ce-b2bab7ce})
#### Replacing triggers tags

Replace tags for trigger.

Request:

``` {.java}
{
    "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:

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

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

[comment]: # ({680d73bb-680d73bb})
### See also

-   [trigger.adddependencies](adddependencies)
-   [trigger.deletedependencies](deletedependencies)

[comment]: # ({/680d73bb-680d73bb})

[comment]: # ({2afbfbeb-2afbfbeb})
### Source

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

[comment]: # ({/2afbfbeb-2afbfbeb})
