[comment]: # translation:outdated

[comment]: # ({fff19f5f-fff19f5f})
# hostinterface.massadd

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

[comment]: # ({5e6b661e-30999da7})
### Descrizione

`object hostinterface.massadd(object parameters)`

Questo metodo consente di aggiungere simultaneamente interfacce host a più
host.

::: noteclassic
Questo metodo è disponibile solo per i tipi di utente *Admin* e *Super admin*.
I permessi per chiamare il metodo possono essere revocati nelle impostazioni del ruolo utente.
Per ulteriori informazioni, vedere [Ruoli utente](/manual/web_interface/frontend_sections/users/user_roles).
:::

[comment]: # ({/5e6b661e-30999da7})

[comment]: # ({682252be-35c0864e})
### Parametri

`(object)` Parametri contenenti le interfacce host da creare
sugli host specificati.

Il metodo accetta i seguenti parametri.

|Parametro|[Type](/manual/api/reference_commentary#data-types)|Descrizione|
|--|--|------|
|interfaces|object/array|[Interfacce host](/manual/api/reference/hostinterface/object) da creare sugli host specificati.<br><br>[Comportamento del parametro](/manual/api/reference_commentary#parameter-behavior):<br>- *obbligatorio*|
|hosts|object/array|[Host](/manual/api/reference/host/object) da aggiornare.<br><br>Gli host devono avere definita solo la proprietà `hostid`.<br><br>[Comportamento del parametro](/manual/api/reference_commentary#parameter-behavior):<br>- *obbligatorio*|

[comment]: # ({/682252be-35c0864e})

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

`(object)` Restituisce un oggetto contenente gli ID delle interfacce dell'host create
sotto la proprietà `interfaceids`.

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

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

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

[comment]: # ({707ed219-ad87458a})
#### Creazione delle interfacce

Crea un'interfaccia su due host.

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

```json
{
    "jsonrpc": "2.0",
    "method": "hostinterface.massadd",
    "params": {
        "hosts": [
            {
                "hostid": "30050"
            },
            {
                "hostid": "30052"
            }
        ],
        "interfaces": {
            "dns": "",
            "ip": "127.0.0.1",
            "main": 0,
            "port": "10050",
            "type": 1,
            "useip": 1
        }
    },
    "id": 1
}
```

Risposta:

```json
{
    "jsonrpc": "2.0",
    "result": {
        "interfaceids": [
            "30069",
            "30070"
        ]
    },
    "id": 1
}
```

[comment]: # ({/707ed219-ad87458a})

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

- [hostinterface.create](create)
- [host.massadd](/manual/api/reference/host/massadd)
- [Host](/manual/api/reference/host/object#host)

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

[comment]: # ({9b65afcc-9b65afcc})
### Fonte

CHostInterface::massAdd() in
*ui/include/classes/api/services/CHostInterface.php*.

[comment]: # ({/9b65afcc-9b65afcc})
