template.massremove
Description
object template.massremove(object parameters)
This method allows to remove related objects from 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.
Parameters
(object)
Parameters containing the IDs of the templates to update and the objects that should be removed.
Parameter | Type | Description |
---|---|---|
templateids | string/array | IDs of the templates to be updated. Parameter behavior: - required |
groupids | string/array | Template groups from which to remove the given templates. |
macros | string/array | User macros to delete from the given templates. |
templateids_clear | string/array | Templates to unlink and clear from the given templates (upstream). |
templateids_link | string/array | Templates to unlink from the given templates (upstream). |
Return values
(object)
Returns an object containing the IDs of the updated templates under the templateids
property.
Examples
Removing templates from a group
Remove two templates from group “2”.
{
"jsonrpc": "2.0",
"method": "template.massremove",
"params": {
"templateids": [
"10085",
"10086"
],
"groupids": "2"
},
"id": 1
}
Response:
{
"jsonrpc": "2.0",
"result": {
"templateids": [
"10085",
"10086"
]
},
"id": 1
}
Unlinking templates from a host
Unlink templates “10106” and “10104” from template “10085”.
{
"jsonrpc": "2.0",
"method": "template.massremove",
"params": {
"templateids": "10085",
"templateids_link": [
"10106",
"10104"
]
},
"id": 1
}
Response:
{
"jsonrpc": "2.0",
"result": {
"templateids": [
"10085"
]
},
"id": 1
}
See also
Source
CTemplate::massRemove() in ui/include/classes/api/services/CTemplate.php.