You are viewing documentation for the development version, it may be incomplete.
Join our translation project and help translate Zabbix documentation into your native language.

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 ID/array IDs of the templates to be updated.

Parameter behavior:
- required
groupids ID/array IDs of the template groups from which to remove the given templates.
macros string/array IDs of the user macros to delete from the given templates.
templateids_clear ID/array IDs of the templates to unlink and clear from the given templates (upstream).
templateids_link ID/array IDs of the 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".

Request:

{
           "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".

Request:

{
           "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.