array template.getobjects(object filter)
This method allows to retrieve templates that match the given filter criteria.
(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. |
(array)
Returns an array of objects with all properties.
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
}
CTemplate::getObject() in frontends/php/api/classes/CTemplate.php.