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 for more information.

    Parameters

    (object) Parameters defining the desired output.

    The method supports the following parameters.

    • an array of objects;

    • the count of retrieved objects, if the countOutput parameter has been used.

    Examples

    Retrieving host prototypes from an LLD rule

    Retrieve all host prototypes, their group links, group prototypes and tags from an LLD rule.

    Request:

    1. {
    2. "jsonrpc": "2.0",
    3. "result": [
    4. {
    5. "hostid": "10092",
    6. "host": "{#HV.UUID}",
    7. "status": "0",
    8. "templateid": "0",
    9. "discover": "0",
    10. "custom_interfaces": "1",
    11. "inventory_mode": "-1",
    12. "groupLinks": [
    13. "group_prototypeid": "4",
    14. "hostid": "10092",
    15. "groupid": "7",
    16. "templateid": "0"
    17. }
    18. ],
    19. "groupPrototypes": [
    20. {
    21. "group_prototypeid": "7",
    22. "hostid": "10092",
    23. "name": "{#CLUSTER.NAME}",
    24. "templateid": "0"
    25. }
    26. ],
    27. "tags": [
    28. {
    29. "tag": "Datacenter",
    30. },
    31. {
    32. "tag": "Instance type",
    33. "value": "{#INSTANCE_TYPE}"
    34. ],
    35. "interfaces": [
    36. {
    37. "main": "1",
    38. "type": "2",
    39. "useip": "1",
    40. "ip": "127.0.0.1",
    41. "dns": "",
    42. "port": "161",
    43. "details": {
    44. "version": "2",
    45. "bulk": "1",
    46. "community": "{$SNMP_COMMUNITY}"
    47. }
    48. }
    49. ]
    50. }
    51. ],
    52. "id": 1

    Source

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