[comment]: # ({8246351f-8246351f})
# itemprototype.get

[comment]: # ({/8246351f-8246351f})

[comment]: # ({a7f55ee1-5f97ef4a})
### Description

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

The method allows to retrieve item 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]: # ({/a7f55ee1-5f97ef4a})

[comment]: # ({3de42ad3-8d6ecc79})
### Parameters

`(object)` Parameters defining the desired output.

The method supports the following parameters.

|Parameter|[Type](/manual/api/reference_commentary#data-types)|Description|
|--|--|------|
|discoveryids|ID/array|Return only item prototypes that belong to the given LLD rules.|
|graphids|ID/array|Return only item prototypes that are used in the given graph prototypes.|
|hostids|ID/array|Return only item prototypes that belong to the given hosts.|
|inherited|boolean|If set to `true` return only item prototypes inherited from a template.|
|itemids|ID/array|Return only item prototypes with the given IDs.|
|monitored|boolean|If set to `true` return only enabled item prototypes that belong to monitored hosts.|
|templated|boolean|If set to `true` return only item prototypes that belong to templates.|
|templateids|ID/array|Return only item prototypes that belong to the given templates.|
|triggerids|ID/array|Return only item prototypes that are used in the given trigger prototypes.|
|selectDiscoveryData|query|Return a `discoveryData` property with the item prototype discovery object data. The item prototype discovery object links a discovered item prototype to an item prototype from which it was discovered.<br><br>It has the following properties:<br>`parent_itemid` - `(string)` ID of the item prototype from which the item prototype has been created;<br>`key_` - `(string)` key of the item prototype;<br>`status` - `(int)` item prototype discovery status:<br>0 - *(default)* item prototype is discovered,<br>1 - item prototype is not discovered anymore;<br>`ts_delete` - `(timestamp)` time when an item prototype that is no longer discovered will be deleted;<br>`ts_disable` - `(timestamp)` time when an item prototype that is no longer discovered will be disabled;<br>`disable_source` - `(int)` indicator of whether item prototype was disabled by an LLD rule or manually:<br>0 - *(default)* disabled automatically,<br>1 - disabled by an LLD rule.|
|selectDiscoveryRule|query|Return a [`discoveryRule`](/manual/api/reference/discoveryrule/object#lld-rule) property with the low-level discovery rule that the item prototype belongs to.|
|selectDiscoveryRulePrototype|query|Return a [`discoveryRulePrototype`](/manual/api/reference/discoveryruleprototype/object) property with the parent LLD rule prototype that the item prototype belongs to.|
|selectGraphs|query|Return a [`graphs`](/manual/api/reference/graphprototype/object#graph-prototype) property with graph prototypes that the item prototype is used in.<br><br>Supports `count`.|
|selectHosts|query|Return a [`hosts`](/manual/api/reference/host/object) property with an array of hosts that the item prototype belongs to.|
|selectInheritedTags|query|Return an [`inheritedTags`](/manual/api/reference/itemprototype/object#item-prototype-tag) property with tags that are on template/host/linked templates.|
|selectTags|query|Return the item prototype tags in [`tags`](/manual/api/reference/itemprototype/object#item-prototype-tag) property.|
|selectTriggers|query|Return a [`triggers`](/manual/api/reference/triggerprototype/object#trigger-prototype) property with trigger prototypes that the item prototype is used in.<br><br>Supports `count`.|
|selectPreprocessing|query|Return a [`preprocessing`](/manual/api/reference/itemprototype/object#item-prototype-preprocessing) property with item prototype preprocessing options.|
|selectValueMap|query|Return a [`valuemap`](/manual/api/reference/valuemap/object) property with item prototype value map.|
|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 item prototype belongs to.|
|limitSelects|integer|Limits the number of records returned by subselects.<br><br>Applies to the following subselects:<br>`selectGraphs` - results will be sorted by `name`;<br>`selectTriggers` - results will be sorted by `description`.|
|sortfield|string/array|Sort the result by the given properties.<br><br>Possible values: `itemid`, `name`, `key_`, `delay`, `type`, `status`, `history`, `trends`, `discovered`.|
|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]: # ({/3de42ad3-8d6ecc79})

[comment]: # ({7223bab1-7223bab1})
### Return values

`(integer/array)` Returns either:

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

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

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

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

[comment]: # ({637433bd-92651f4c})
#### Retrieving item prototypes from an LLD rule

Retrieve all item prototypes for specific LLD rule ID.

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

```json
{
    "jsonrpc": "2.0",
    "method": "itemprototype.get",
    "params": {
        "output": "extend",
        "discoveryids": "27426"
    },
    "id": 1
}
```

Response:

```json
{
    "jsonrpc": "2.0",
    "result": [
        {
            "itemid": "23077",
            "type": "0",
            "snmp_oid": "",
            "hostid": "10079",
            "name": "Incoming network traffic on en0",
            "key_": "net.if.in[en0]",
            "delay": "1m",
            "history": "1w",
            "trends": "365d",
            "status": "0",
            "value_type": "3",
            "trapper_hosts": "",
            "units": "bps",
            "formula": "",
            "logtimefmt": "",
            "templateid": "0",
            "valuemapid": "0",
            "params": "",
            "ipmi_sensor": "",
            "authtype": "0",
            "username": "",
            "password": "",
            "publickey": "",
            "privatekey": "",
            "flags": "2",
            "interfaceid": "0",
            "description": "",
            "inventory_link": "0",
            "lifetime": "7d",
            "evaltype": "0",
            "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",
            "output_format": "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": []
        },
        {
            "itemid": "10010",
            "type": "0",
            "snmp_oid": "",
            "hostid": "10001",
            "name": "Processor load (1 min average per core)",
            "key_": "system.cpu.load[percpu,avg1]",
            "delay": "1m",
            "history": "1w",
            "trends": "365d",
            "status": "0",
            "value_type": "0",
            "trapper_hosts": "",
            "units": "",
            "formula": "",
            "logtimefmt": "",
            "templateid": "0",
            "valuemapid": "0",
            "params": "",
            "ipmi_sensor": "",
            "authtype": "0",
            "username": "",
            "password": "",
            "publickey": "",
            "privatekey": "",
            "flags": "2",
            "interfaceid": "0",
            "description": "The processor load is calculated as system CPU load divided by number of CPU cores.",
            "inventory_link": "0",
            "lifetime": "7d",
            "evaltype": "0",
            "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",
            "output_format": "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]: # ({/637433bd-92651f4c})

[comment]: # ({3c8f8511-acb23a7a})
#### Finding dependent item

Find one Dependent item for specific item ID.

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

```json
{
    "jsonrpc": "2.0",
    "method": "itemprototype.get",
    "params": {
        "output": "extend",
        "filter": {
            "type": 18,
            "master_itemid": "25545"
        },
        "limit": "1"
    },
    "id": 1
}
```

Response:

```json
{
    "jsonrpc": "2.0",
    "result": [
        {
            "itemid": "25547",
            "type": "18",
            "snmp_oid": "",
            "hostid": "10116",
            "name": "Seconds",
            "key_": "apache.status.uptime.seconds",
            "delay": "0",
            "history": "90d",
            "trends": "365d",
            "status": "0",
            "value_type": "3",
            "trapper_hosts": "",
            "units": "",
            "formula": "",
            "logtimefmt": "",
            "templateid": "0",
            "valuemapid": "0",
            "params": "",
            "ipmi_sensor": "",
            "authtype": "0",
            "username": "",
            "password": "",
            "publickey": "",
            "privatekey": "",
            "flags": "0",
            "interfaceid": "0",
            "description": "",
            "inventory_link": "0",
            "lifetime": "7d",
            "evaltype": "0",
            "jmx_endpoint": "",
            "master_itemid": "25545",
            "timeout": "",
            "url": "",
            "query_fields": [],
            "posts": "",
            "status_codes": "200",
            "follow_redirects": "1",
            "post_type": "0",
            "http_proxy": "",
            "headers": [],
            "retrieve_mode": "0",
            "request_method": "0",
            "output_format": "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]: # ({/3c8f8511-acb23a7a})

[comment]: # ({a9e7c7e6-18563427})
#### Find HTTP agent item prototype

Find HTTP agent item prototype with request method HEAD for specific host ID.

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

```json
{
    "jsonrpc": "2.0",
    "method": "itemprototype.get",
    "params": {
        "hostids": "10254",
        "filter": {
            "type": 19,
            "request_method": 3
        }
    },
    "id": 1
}
```

Response:

```json
{
    "jsonrpc": "2.0",
    "result": [
        {
            "itemid": "28257",
            "type": "19",
            "snmp_oid": "",
            "hostid": "10254",
            "name": "discovered",
            "key_": "item[{#INAME}]",
            "delay": "{#IUPDATE}",
            "history": "90d",
            "trends": "30d",
            "status": "0",
            "value_type": "3",
            "trapper_hosts": "",
            "units": "",
            "formula": "",
            "logtimefmt": "",
            "templateid": "28255",
            "valuemapid": "0",
            "params": "",
            "ipmi_sensor": "",
            "authtype": "0",
            "username": "",
            "password": "",
            "publickey": "",
            "privatekey": "",
            "flags": "2",
            "interfaceid": "2",
            "description": "",
            "inventory_link": "0",
            "lifetime": "7d",
            "evaltype": "0",
            "jmx_endpoint": "",
            "master_itemid": "0",
            "timeout": "",
            "url": "{#IURL}",
            "query_fields": [],
            "posts": "",
            "status_codes": "",
            "follow_redirects": "0",
            "post_type": "0",
            "http_proxy": "",
            "headers": [],
            "retrieve_mode": "0",
            "request_method": "3",
            "output_format": "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]: # ({/a9e7c7e6-18563427})

[comment]: # ({784c3a3e-b9b138b8})
### See also

-   [Host](/manual/api/reference/host/object#host)
-   [Graph prototype](/manual/api/reference/graphprototype/object#graph-prototype)
-   [Trigger prototype](/manual/api/reference/triggerprototype/object#trigger-prototype)

[comment]: # ({/784c3a3e-b9b138b8})

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

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

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