[comment]: # translation:outdated

[comment]: # ({66c5a546-66c5a546})
# host.massadd

[comment]: # ({/66c5a546-66c5a546})

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

`objektum host.massadd(objektumparaméterek)`

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

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

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

`(object)` Parameters containing the IDs of the hosts to update and the
objects to add to all the hosts.

The method accepts the following parameters.

|Parameter|[Type](/manual/api/reference_commentary#data_types)|Description|
|--|--|------|
|**hosts**<br>(required)|object/array|Hosts to be updated.<br><br>The hosts must have the `hostid` property defined.|
|groups|object/array|Host groups to add to the given hosts.<br><br>The host groups must have the `groupid` property defined.|
|interfaces|object/array|[Host interfaces](/manual/api/reference/hostinterface/object) to be created for the given hosts.|
|macros|object/array|[User macros](/manual/api/reference/usermacro/object) to be created for the given hosts.|
|templates|object/array|Templates to link to the given hosts.<br><br>The templates must have the `templateid` property defined.|

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

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

`(objektum)` visszaad egy objektumot, amely tartalmazza a frissített gazdagépek azonosítóit
a `hostidok` tulajdona alatt.

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

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

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

[comment]: # ({f170f1a8-453a1298})
#### Makrók hozzáadása

Adjon hozzá két új makrót két gazdagéphez.

Kérés:

``` json
{
    "jsonrpc": "2.0",
    "method": "host.massadd",
    "params": {
        "hosts": [
            {
                "hostid": "10160"
            },
            {
                "hostid": "10167"
            }
        ],
        "macros": [
            {
                "macro": "{$TEST1}",
                "value": "MACROTEST1"
            },
            {
                "macro": "{$TEST2}",
                "value": "MACROTEST2",
                "description": "Teszt leírása"
            }
        ]
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}
```

Válasz:

``` json
{
    "jsonrpc": "2.0",
    "eredmény": {
        "hostids": [
            "10160",
            "10167"
        ]
    },
    "azonosító": 1
}
```

[comment]: # ({/f170f1a8-453a1298})

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

- [host.update](frissítés)
- [Gazdagépcsoport](/manual/api/reference/hostgroup/object#host_group)
- [Sablon](/manual/api/reference/template/object#template)
- [Felhasználó
    makró](/manual/api/reference/usermacro/object#hosttemplate_level_macro)
-   [Házigazda
    interface](/manual/api/reference/hostinterface/object#host_interface)

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

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

CHost::massAdd() az *ui/include/classes/api/services/CHost.php*-ban.

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