[comment]: # ({0a1af107-0a1af107})
# drule.update

[comment]: # ({/0a1af107-0a1af107})

[comment]: # ({cec59166-cec59166})
### Description

`object drule.update(object/array discoveryRules)`

This method allows to update existing discovery rules.

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

[comment]: # ({25b91ab1-6ceb5dc0})
### Parameters

`(object/array)` Discovery rule properties to be updated.

The `druleid` property must be defined for each discovery rule, all
other properties are optional. Only the passed properties will be
updated, all others will remain unchanged.

Additionally to the [standard discovery rule
properties](object#discovery_rule), the method accepts the following
parameters.

|Parameter|Type|Description|
|---------|----|-----------|
|dchecks|array|Discovery checks to replace existing checks.|

[comment]: # ({/25b91ab1-6ceb5dc0})

[comment]: # ({495f933e-495f933e})
### Return values

`(object)` Returns an object containing the IDs of the updated discovery
rules under the `druleids` property.

[comment]: # ({/495f933e-495f933e})

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

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

[comment]: # ({11119b8e-11119b8e})
#### Change the IP range of a discovery rule

Change the IP range of a discovery rule to "192.168.2.1-255".

Request:

``` {.java}
{
    "jsonrpc": "2.0",
    "method": "drule.update",
    "params": {
        "druleid": "6",
        "iprange": "192.168.2.1-255"
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}
```

Response:

``` {.java}
{
    "jsonrpc": "2.0",
    "result": {
        "druleids": [
            "6"
        ]
    },
    "id": 1
}
```

[comment]: # ({/11119b8e-11119b8e})

[comment]: # ({54664cce-54664cce})
### See also

-   [Discovery
    check](/manual/api/reference/dcheck/object#discovery_check)

[comment]: # ({/54664cce-54664cce})

[comment]: # ({affe81d0-affe81d0})
### Source

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

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