[comment]: # translation:outdated

[comment]: # ({ae0db7b8-ae0db7b8})
# template.massremove

[comment]: # ({/ae0db7b8-ae0db7b8})

[comment]: # ({new-ba911402})
### Description

`object template.massremove(object parameters)`

This method allows to remove related objects from multiple templates.

::: noteclassic
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](/manual/web_interface/frontend_sections/administration/user_roles)
for more information.
:::

[comment]: # ({/new-ba911402})

[comment]: # ({new-bd7f8b44})
### Parameters

`(object)` Parameters containing the IDs of the templates to update and
the objects that should be removed.

|Parameter|[Type](/manual/api/reference_commentary#data_types)|Description|
|---------|---------------------------------------------------|-----------|
|**templateids**<br>(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).|

[comment]: # ({/new-bd7f8b44})

[comment]: # ({dcba01c8-dcba01c8})
### Valori di ritorno

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

[comment]: # ({/dcba01c8-dcba01c8})

[comment]: # ({b41637d2-b41637d2})
### Esempi

[comment]: # ({/b41637d2-b41637d2})

[comment]: # ({new-20c1ddc2})
#### Removing templates from a group

Remove two templates from group "2".

Request:

``` {.java}
{
    "jsonrpc": "2.0",
    "method": "template.massremove",
    "params": {
        "templateids": [
            "10085",
            "10086"
        ],
        "groupids": "2"
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}
```

Response:

``` {.java}
{
    "jsonrpc": "2.0",
    "result": {
        "templateids": [
            "10085",
            "10086"
        ]
    },
    "id": 1
}
```

[comment]: # ({/new-20c1ddc2})

[comment]: # ({new-5ec690e5})
#### Unlinking templates from a host

Unlink templates "10106", "10104" from template "10085".

Request:

``` {.java}
{
    "jsonrpc": "2.0",
    "method": "template.massremove",
    "params": {
        "templateids": "10085",
        "templateids_link": [
            "10106",
            "10104"
        ]
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}
```

Response:

``` {.java}
{
    "jsonrpc": "2.0",
    "result": {
        "templateids": [
            "10085"
        ]
    },
    "id": 1
}
```

[comment]: # ({/new-5ec690e5})

[comment]: # ({186aec66-186aec66})
### Guarda anche

- [template.update](update)
- [Macro utente](/manual/api/reference/usermacro/object#hosttemplate_level_macro)

[comment]: # ({/186aec66-186aec66})

[comment]: # ({aba9c6f9-aba9c6f9})
### Fonte

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

[comment]: # ({/aba9c6f9-aba9c6f9})
