[comment]: # translation:outdated

[comment]: # ({8c618db1-8c618db1})
# template.massadd

[comment]: # ({/8c618db1-8c618db1})

[comment]: # ({399b9834-399b9834})
### Leírás

`object template.massadd(objektumparaméterek)`

Ez a módszer lehetővé teszi több kapcsolódó objektum egyidejű hozzáadását a
adott sablonok.

::: 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]: # ({/399b9834-399b9834})

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

`(object)` Parameters containing the IDs of the templates to update and
the objects to add to 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 add the given templates to.<br><br>The host groups must have the `groupid` property defined.|
|macros|object/array|User macros to be created for the given templates.|
|templates\_link|object/array|Templates to link to the given templates.<br><br>The templates must have the `templateid` property defined.|

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

[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-f8fe44e4})
#### Link a group to a templates

Add host group "2" to a two templates.

Request:

```json
{
    "jsonrpc": "2.0",
    "method": "template.massadd",
    "params": {
        "templates": [
            {
                "templateid": "10085"
            },
            {
                "templateid": "10086"
            }
        ],
        "groups": [
            {
                "groupid": "2"
            }
        ]
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}
```

Response:

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

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

[comment]: # ({new-610a67a7})
#### Link a two tempalates to a template

Link templates "10106" and "10104" to template.

Request:

```json
{
    "jsonrpc": "2.0",
    "method": "template.massadd",
    "params": {
        "templates": [
            {
                "templateid": "10073"
            }
        ],
        "templates_link": [
            {
                "templateid": "10106"
            },
            {
                "templateid": "10104"
            }
        ]
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}
```

Response:

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

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

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

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

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

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

CTemplate::massAdd() az *ui/include/classes/api/services/CTemplate.php* fájlban.

[comment]: # ({/2f7abcb1-2f7abcb1})
