[comment]: # ({de78f971-2ea30393})
# discoveryruleprototype.get

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

[comment]: # ({402b74ae-2a4a3845})
### Description

`integer/array discoveryruleprototype.get(object parameters)`

The method allows to retrieve LLD rule prototypes according to the given
parameters.

::: noteclassic
This method is available to users of any type. Permissions
to call the method can be revoked in user role settings. See [User
roles](/manual/web_interface/frontend_sections/users/user_roles)
for more information.
:::

[comment]: # ({/402b74ae-2a4a3845})

[comment]: # ({54e078c5-ef542c37})

### Parameters

`(object)` Parameters defining the desired output.

The method supports the following parameters.

|Parameter|[Type](/manual/api/reference_commentary#data-types)|Description|
|--|--|------|
|itemids|ID/array|Return only LLD rule prototypes with the given IDs.|
|groupids|ID/array|Return only LLD rule prototypes that belong to the hosts from the given groups.|
|hostids|ID/array|Return only LLD rule prototypes that belong to the given hosts.|
|inherited|boolean|If set to `true` return only LLD rule prototypes inherited from a template.|
|interfaceids|ID/array|Return only LLD rule prototypes use the given host interfaces.|
|monitored|boolean|If set to `true` return only enabled LLD rule prototypes that belong to monitored hosts.|
|templated|boolean|If set to `true` return only LLD rule prototypes that belong to templates.|
|templateids|ID/array|Return only LLD rule prototypes that belong to the given templates.|
|selectDiscoveryRule|query|Return a [`discoveryRule`](/manual/api/reference/discoveryrule/object) property with the parent LLD rule of the LLD rule prototype.|
|selectDiscoveryRulePrototype|query|Return a [`discoveryRulePrototype`](/manual/api/reference/discoveryruleprototype/object) property with the parent LLD rule prototype of the LLD rule prototype.|
|selectDiscoveryRulePrototypes|query|Return a [`discoveryRulePrototypes`](/manual/api/reference/discoveryruleprototype/object) property with child LLD rule prototypes that belong to the LLD rule prototype.<br><br>Supports `count`.|
|selectFilter|query|Return a [`filter`](/manual/api/reference/discoveryruleprototype/object#lld-rule-prototype-filter) property with data of the filter used by the LLD rule prototype.|
|selectGraphs|query|Returns a [`graphs`](/manual/api/reference/graph/object) property with graph prototypes that belong to the LLD rule prototype.<br><br>Supports `count`.|
|selectHostPrototypes|query|Return a [`hostPrototypes`](/manual/api/reference/hostprototype/object) property with host prototypes that belong to the LLD rule prototype.<br><br>Supports `count`.|
|selectHosts|query|Return a [`hosts`](/manual/api/reference/host/object) property with an array of hosts that the LLD rule prototype belongs to.|
|selectItems|query|Return an [`items`](/manual/api/reference/item/object) property with item prototypes that belong to the LLD rule prototype.<br><br>Supports `count`.|
|selectTriggers|query|Return a [`triggers`](/manual/api/reference/trigger/object) property with trigger prototypes that belong to the LLD rule prototype.<br><br>Supports `count`.|
|selectLLDMacroPaths|query|Return an [`lld_macro_paths`](/manual/api/reference/discoveryruleprototype/object#lld-macro-path) property with a list of LLD macros and paths to values assigned to each corresponding macro.|
|selectPreprocessing|query|Return a [`preprocessing`](/manual/api/reference/discoveryruleprototype/object#lld-rule-prototype-preprocessing) property with LLD rule prototype preprocessing options.|
|selectOverrides|query|Return an [`lld_rule_overrides`](/manual/api/reference/discoveryruleprototype/object#lld-rule-prototype-overrides) property with a list of override filters, conditions and operations that are performed on prototype objects.|
|filter|object|Return only those results that exactly match the given filter.<br><br>Accepts an object, where the keys are property names, and the values are either a single value or an array of values to match against.<br><br>Does not support properties of `text` [data type](/manual/api/reference_commentary#data-types).<br><br>Supports additional properties:<br>`host` - technical name of the host that the LLD rule prototype belongs to.|
|limitSelects|integer|Limits the number of records returned by subselects.<br><br>Applies to the following subselects: `selectItems`, `selectGraphs`, `selectTriggers`.|
|sortfield|string/array|Sort the result by the given properties.<br><br>Possible values: `itemid`, `name`, `key_`, `delay`, `type`, `status`.|
|countOutput|boolean|These parameters are described in the [reference commentary](/manual/api/reference_commentary#common-get-method-parameters).|
|editable|boolean|^|
|excludeSearch|boolean|^|
|limit|integer|^|
|output|query|^|
|preservekeys|boolean|^|
|search|object|^|
|searchByAny|boolean|^|
|searchWildcardsEnabled|boolean|^|
|sortorder|string/array|^|
|startSearch|boolean|^|

[comment]: # ({/54e078c5-ef542c37})

[comment]: # ({7223bab1-8b420463})

### Return values

`(integer/array)` Returns either:

-   an array of objects;
-   the count of retrieved objects, if the `countOutput` parameter has
    been used.

[comment]: # ({/7223bab1-8b420463})

[comment]: # ({b41637d2-688543cd})

### Examples

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

[comment]: # ({8717c31a-454ae381})

#### Retrieving discovery rule prototypes from a host

Retrieve all discovery rule prototypes for specific host ID.

[Request](/manual/api#performing-requests):

```json
{
    "jsonrpc": "2.0",
    "method": "discoveryruleprototype.get",
    "params": {
        "hostids": "10084"
    },
    "id": 1
}
```

[comment]: # ({/8717c31a-454ae381})

[comment]: # ({7789e5ca-8ebdd835})

Response:

```json
{
    "jsonrpc": "2.0",
    "result": [
        {
            "itemid": "47253",
            "type": "23",
            "snmp_oid": "",
            "hostid": "10084",
            "name": "Discover tablespaces for {#DB}",
            "key_": "db.tablespace.discovery[{#DB}]",
            "delay": "0",
            "history": "31d",
            "trends": "365d",
            "status": "0",
            "value_type": "4",
            "trapper_hosts": "",
            "units": "",
            "logtimefmt": "",
            "templateid": "0",
            "valuemapid": "0",
            "params": "",
            "ipmi_sensor": "",
            "authtype": "0",
            "username": "",
            "password": "",
            "publickey": "",
            "privatekey": "",
            "flags": "3",
            "interfaceid": "0",
            "description": "",
            "inventory_link": "0",
            "lifetime": "7d",
            "jmx_endpoint": "",
            "master_itemid": "0",
            "timeout": "",
            "url": "",
            "query_fields": [],
            "posts": "",
            "status_codes": "200",
            "follow_redirects": "1",
            "post_type": "0",
            "http_proxy": "",
            "headers": [],
            "retrieve_mode": "0",
            "request_method": "0",
            "ssl_cert_file": "",
            "ssl_key_file": "",
            "ssl_key_password": "",
            "verify_peer": "0",
            "verify_host": "0",
            "allow_traps": "0",
            "discover": "0",
            "uuid": "",
            "lifetime_type": "0",
            "enabled_lifetime_type": "2",
            "enabled_lifetime": "0",
            "parameters": []
        }
    ],
    "id": 1
}
```

[comment]: # ({/7789e5ca-8ebdd835})

[comment]: # ({aacb1673-4de7e4ef})
### See also

-   [Graph prototype](/manual/api/reference/graphprototype/object#graph-prototype)
-   [Host](/manual/api/reference/host/object#host)
-   [Item prototype](/manual/api/reference/itemprototype/object#item-prototype)
-   [LLD rule prototype filter](object#lld-rule-prototype-filter)
-   [Trigger prototype](/manual/api/reference/triggerprototype/object#trigger-prototype)

[comment]: # ({/aacb1673-4de7e4ef})

[comment]: # ({28b25723-8d71dafa})
### Source

CDiscoveryRulePrototype::get() in
*ui/include/classes/api/services/CDiscoveryRulePrototype.php*.

[comment]: # ({/28b25723-8d71dafa})
