This is a translation of the original English documentation page. Help us make it better.

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
(required)
string/array IDs of the templates to be updated.
groupids string/array Host groups to remove the given templates from.
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).

Valori di ritorno

(object) Restituisce un oggetto contenente gli ID dei modelli aggiornati sotto la proprietà templateids.

Esempi

Removing templates from a group

Remove two templates from group "2".

Request:

{
           "jsonrpc": "2.0",
           "method": "template.massremove",
           "params": {
               "templateids": [
                   "10085",
                   "10086"
               ],
               "groupids": "2"
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "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
       }

Guarda anche

Fonte

CTemplate::massRemove() in ui/include/classes/api/services/CTemplate.php.