[comment]: # translation:outdated

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

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

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

`object hostinterface.massadd(object parameters)`

Cette méthode permet d’ajouter simultanément des interfaces d’hôte à plusieurs
hôtes.

::: noteclassic
Cette méthode est disponible uniquement pour les types d’utilisateur *Admin* et *Super admin*.
Les autorisations d’appel de la méthode peuvent être révoquées dans les paramètres des rôles utilisateur.
Consultez [User
roles](/manual/web_interface/frontend_sections/users/user_roles)
pour plus d’informations.
:::

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

[comment]: # ({682252be-35c0864e})
### Paramètres

`(object)` Paramètres contenant les interfaces d'hôte à créer sur
les hôtes donnés.

La méthode accepte les paramètres suivants.

|Paramètre|[Type](/manual/api/reference_commentary#data-types)|Description|
|--|--|------|
|interfaces|object/array|[Interfaces d'hôte](/manual/api/reference/hostinterface/object) à créer sur les hôtes donnés.<br><br>[Comportement du paramètre](/manual/api/reference_commentary#parameter-behavior):<br>- *obligatoire*|
|hosts|object/array|[Hôtes](/manual/api/reference/host/object) à mettre à jour.<br><br>Les hôtes doivent avoir uniquement la propriété `hostid` définie.<br><br>[Comportement du paramètre](/manual/api/reference_commentary#parameter-behavior):<br>- *obligatoire*|

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

[comment]: # ({88283807-88283807})
### Valeurs retournées

`(object)` Retourne un objet contenant les identifiants des interfaces hôtes créées sous la propriété `interfaceids`.

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

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

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

[comment]: # ({707ed219-ad87458a})
#### Création d’interfaces

Créez une interface sur deux hôtes.

[Requête](/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
}
```

Réponse :

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

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

[comment]: # ({a2a46209-a2a46209})
### Voir également

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

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

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

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

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