[comment]: # ({e42e8a0a-e42e8a0a})
# template.massupdate

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

[comment]: # ({5f9e3e62-cf27d8f8})
### Leírás

`object template.massupdate(object parameters)`

Ez a módszer lehetővé teszi a kapcsolódó objektumok egyidejű cseréjét vagy eltávolítását
és frissítse a tulajdonságokat több sablonon.

::: noteclassic
Ez a módszer csak az *Admin* és a *Kiemelt rendszergazda* számára érhető el
felhasználói típusok. A metódus meghívására vonatkozó engedélyek felhasználói szerepkörben visszavonhatók
beállítások. Lásd: [User
roles](/manual/web_interface/frontend_sections/administration/user_roles)
további információért.
:::

[comment]: # ({/5f9e3e62-cf27d8f8})

[comment]: # ({b2e67223-1f7d5759})
### Parameters

`(object)` Parameters containing the IDs of the templates to update and the objects to replace for the templates.

The method accepts the following parameters.

|Parameter|[Type](/manual/api/reference_commentary#data_types)|Description|
|--|--|------|
|**templates**<br>(required)|object/array|Templates to be updated.<br><br>The templates must have the `templateid` property defined.|
|groups|object/array|Host groups to replace the current host groups the templates belong to.<br><br>The host groups must have the `groupid` property defined.|
|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.<br><br>The templates must have the `templateid` property defined.|
|templates\_link|object/array|Templates to replace the currently linked templates.<br><br>The templates must have the `templateid` property defined.|

[comment]: # ({/b2e67223-1f7d5759})

[comment]: # ({dcba01c8-dcba01c8})
### Visszatérési értékek

`(object)` A frissített sablonok azonosítóit tartalmazó objektumot ad vissza
a `templateids` tulajdonság alatt.

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

[comment]: # ({b41637d2-b41637d2})
### Példák

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

[comment]: # ({new-d18b091c})
#### Unlinking a template

Unlink and clear template "10091" from the given templates.

[Request](/manual/api#performing-requests):

```json
{
    "jsonrpc": "2.0",
    "method": "template.massupdate",
    "params": {
        "templates": [
            {
                "templateid": "10085"
            },
            {
                "templateid": "10086"
            }
        ],
        "templates_clear": [
            {
                "templateid": "10091"
            }
        ]
    },
    "id": 1
}
```

Response:

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

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

[comment]: # ({fbe72d1c-0ecefb75})
#### Replacing host groups

Unlink and clear template "10091" from the given templates.

Request:

```json
{
    "jsonrpc": "2.0",
    "method": "template.massupdate",
    "params": {
        "templates": [
            {
                "templateid": "10085"
            },
            {
                "templateid": "10086"
            }
        ],
        "templates_clear": [
            {
                "templateid": "10091"
            }
        ]
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}
```

Response:

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

[comment]: # ({/fbe72d1c-0ecefb75})

[comment]: # ({bb51c245-5d283e35})
### Lásd még

- [template.update](frissítés)
- [sablon.massadd] (massadd)
- [Gazdagépcsoport](/manual/api/reference/hostgroup/object#host_group)
- [Felhasználói makró](/manual/api/reference/usermacro/object#hosttemplate_level_macro)

[comment]: # ({/bb51c245-5d283e35})

[comment]: # ({b5f8dcd9-b5f8dcd9})
### Forrás

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

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