integer/array hostprototype.get(object parameters)
The method allows to retrieve host prototypes according to the given parameters.
This method is available to users of any type. Permissions to call the method can be revoked in user role settings. See User roles for more information.
(object) Parameters defining the desired output.
The method supports the following parameters.
| Parameter | Type | Description | 
|---|---|---|
| hostids | ID/array | Return only host prototypes with the given IDs. | 
| discoveryids | ID/array | Return only host prototypes that belong to the given LLD rules. | 
| inherited | boolean | If set to truereturn only items inherited from a template. | 
| selectDiscoveryData | query | Return a discoveryDataproperty with the host prototype discovery object data. The host prototype discovery object links a discovered host prototype to a host prototype from which it was discovered.It has the following properties: host-(string)ID of the host;parent_hostid-(string)ID of the host prototype from which the host prototype has been created;status-(int)host prototype discovery status:0 - (default) host prototype is discovered, 1 - host prototype is not discovered anymore; ts_delete-(timestamp)time when a host prototype that is no longer discovered will be deleted;ts_disable-(timestamp)time when a host prototype that is no longer discovered will be disabled;disable_source-(int)indicator of whether host prototype was disabled by an LLD rule or manually:0 - (default) disabled automatically, 1 - disabled by an LLD rule. | 
| selectDiscoveryRule | query | Return a discoveryRuleproperty with the LLD rule that the host prototype belongs to. | 
| selectDiscoveryRulePrototype | query | Return a discoveryRulePrototypeproperty with the parent LLD rule prototype that the host prototype belongs to. | 
| selectInterfaces | query | Return an interfacesproperty with host prototype custom interfaces. | 
| selectGroupLinks | query | Return a groupLinksproperty with the group links of the host prototype. | 
| selectGroupPrototypes | query | Return a groupPrototypesproperty with the group prototypes of the host prototype. | 
| selectMacros | query | Return a macrosproperty with host prototype macros. | 
| selectParentHost | query | Return a parentHostproperty with the host that the host prototype belongs to. | 
| selectTags | query | Return a tagsproperty with host prototype tags. | 
| selectTemplates | query | Return a templatesproperty with the templates linked to the host prototype.Supports count. | 
| sortfield | string/array | Sort the result by the given properties. Possible values: hostid,host,name,status,discovered. | 
| countOutput | boolean | These parameters are described in the reference commentary. | 
| editable | boolean | |
| excludeSearch | boolean | |
| filter | object | |
| limit | integer | |
| output | query | |
| preservekeys | boolean | |
| search | object | |
| searchByAny | boolean | |
| searchWildcardsEnabled | boolean | |
| sortorder | string/array | |
| startSearch | boolean | 
(integer/array) Returns either:
countOutput parameter has been used.Retrieve all host prototypes, their group links, group prototypes and tags from an LLD rule.
{
           "jsonrpc": "2.0",
           "method": "hostprototype.get",
           "params": {
               "output": "extend",
               "selectInterfaces": "extend",
               "selectGroupLinks": "extend",
               "selectGroupPrototypes": "extend",
               "selectTags": "extend",
               "discoveryids": "23554"
           },
           "id": 1
       }Response:
{
           "jsonrpc": "2.0",
           "result": [
               {
                   "hostid": "10092",
                   "host": "{#HV.UUID}",
                   "name": "{#HV.UUID}",
                   "status": "0",
                   "templateid": "0",
                   "flags": "2",
                   "discover": "0",
                   "custom_interfaces": "1",
                   "inventory_mode": "-1",
                   "groupLinks": [
                       {
                           "group_prototypeid": "4",
                           "hostid": "10092",
                           "groupid": "7",
                           "templateid": "0"
                       }
                   ],
                   "groupPrototypes": [
                       {
                           "group_prototypeid": "7",
                           "hostid": "10092",
                           "name": "{#CLUSTER.NAME}",
                           "templateid": "0"
                       }
                   ],
                   "tags": [
                       {
                           "tag": "datacenter",
                           "value": "{#DATACENTER.NAME}"
                       },
                       {
                           "tag": "instance-type",
                           "value": "{#INSTANCE_TYPE}"
                       }
                   ],
                   "interfaces": [
                       {
                           "main": "1",
                           "type": "2",
                           "useip": "1",
                           "ip": "127.0.0.1",
                           "dns": "",
                           "port": "161",
                           "details": {
                               "version": "2",
                               "bulk": "1",
                               "community": "{$SNMP_COMMUNITY}",
                               "max_repetitions": "10"
                           }
                       }
                   ]
               }
           ],
           "id": 1
       }CHostPrototype::get() in ui/include/classes/api/services/CHostPrototype.php.