On this page
template.getobjects
Description
array template.getobjects(object filter)
This method allows to retrieve templates that match the given filter criteria.
Parameters
(object) Criteria to search by.
Additionally to the standard standard template properties the following parameters are supported as search criteria.
| Parameter | Type | Description |
|---|---|---|
| node | string | Name of the node the templates must belong to. This will override the nodeids parameter. |
| nodeids | string/array | ID of the node the templates must belong to. |
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"
},
{
"host": "Template OS Windows",
"name": "Template OS Windows",
"templateid": "10081"
}
],
"id": 1
}
See also
Source
CTemplate::getObject() in frontends/php/api/classes/CTemplate.php.