object template.massupdate(object parameters)
This method allows to simultaneously replace or remove related objects and update properties on multiple templates.
This method is only available to Admin and Super admin user types. Permissions to call the method can be revoked in user role settings. See User roles for more information.
(object)
Parameters containing the IDs of the templates to update and the objects to replace for the templates.
The method accepts the following parameters.
Parameter | Type | Description |
---|---|---|
templates | object/array | Templates to be updated. The templates must have only the templateid property defined.Parameter behavior: - required |
groups | object/array | Template groups to replace the current template groups the templates belong to. The template groups must have only the groupid property defined. |
macros | object/array | User macros to replace all of the current user macros on the given templates. |
templates_clear | object/array | Templates to unlink and clear from the given templates. The templates must have only the templateid property defined. |
templates_link | object/array | Templates to replace the currently linked templates. The templates must have only the templateid property defined. |
(object)
Returns an object containing the IDs of the updated templates under the templateids
property.
Unlink and clear template "10091" from the given templates.
{
"jsonrpc": "2.0",
"method": "template.massupdate",
"params": {
"templates": [
{
"templateid": "10085"
},
{
"templateid": "10086"
}
],
"templates_clear": [
{
"templateid": "10091"
}
]
},
"id": 1
}
Response:
Replace all user macros with the given user macro on multiple templates.
{
"jsonrpc": "2.0",
"method": "template.massupdate",
"params": {
"templates": [
{
"templateid": "10074"
},
{
"templateid": "10075"
},
{
"templateid": "10076"
},
{
"templateid": "10077"
}
],
"macros": [
{
"macro": "{$AGENT.TIMEOUT}",
"value": "5m",
"description": "Timeout after which agent is considered unavailable. Works only for agents reachable from Zabbix server/proxy (passive mode)."
}
]
},
"id": 1
}
Response:
CTemplate::massUpdate() in ui/include/classes/api/services/CTemplate.php.