Zabbix Documentation 2.4

Sidebar

template.getobjects

Description

array template.getobjects(object filter)

This method allows to retrieve templates that match the given filter criteria.

This method is deprecated and will be removed in the future. Please use template.get instead.

Parameters

(object) Template properties to search by.

Return values

(array) Returns an array of objects with all properties.

Examples

Retrieving templates by name

Retrieve all data about two templates named “Template OS Linux” and “Template OS Windows”.

Request:

{
           "jsonrpc": "2.0",
           "method": "template.getobjects",
           "params": {
               "host": [
                   "Template OS Linux",
                   "Template OS Windows"
               ]
           },
           "auth": "3a57200802b24cda67c4e4010b50c065",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": [
               {
                   "host": "Template OS Linux",
                   "name": "Template OS Linux",
                   "templateid": "10001",
                   "description": ""
               },
               {
                   "host": "Template OS Windows",
                   "name": "Template OS Windows",
                   "templateid": "10081",
                   "description": ""
               }
           ],
           "id": 1
       }

See also

Source

CTemplate::getObject() in frontends/php/include/classes/api/services/CTemplate.php.