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 properties that should be updated.
Additionally to the standard template properties, the method accepts the following parameters.
Parameter | Type | Description |
---|---|---|
templates (required) |
object/array | Templates to be updated. The templates must have the templateid property defined. |
groups | object/array | Host groups to replace the current host groups the templates belong to. The host groups must have the groupid property defined. |
hosts | object/array | Hosts and templates to replace the ones the templates are currently linked to. Both hosts and templates must use the hostid property to pass an ID. |
macros | object/array | User macros to replace 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 the templateid property defined. |
templates_link | object/array | Templates to replace the currently linked templates. The templates must have 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.
Request:
{
"jsonrpc": "2.0",
"method": "template.massupdate",
"params": {
"templates": [
{
"templateid": "10085"
},
{
"templateid": "10086"
}
],
"templates_clear": [
{
"templateid": "10091"
}
]
},
"auth": "038e1d7b1735c6a5436ee9eae095879e",
"id": 1
}
Response:
CTemplate::massUpdate() in ui/include/classes/api/services/CTemplate.php.