[comment]: # ({2898fc4b-2898fc4b})
# hostinterface.replacehostinterfaces

[comment]: # ({/2898fc4b-2898fc4b})

[comment]: # ({f14e7778-f14e7778})
### Beschrijving

`object hostinterface.replacehostinterfaces(objectparameters)`

Met deze methode kunnen alle hostinterfaces op een bepaalde host worden vervangen.

::: noteclassic
Deze methode is alleen beschikbaar voor *Admin* en *Super admin*
gebruikers typen. Machtigingen om de methode aan te roepen kunnen worden ingetrokken in de gebruikersrol
instellingen. Zie [Gebruiker
rollen](/manual/web_interface/frontend_sections/administration/user_roles)
voor meer informatie.
:::

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

[comment]: # ({5ad866d6-f5cf0b40})
### Parameters

`(object)` Parameters met de ID van de host die moet worden bijgewerkt en
de nieuwe host-interfaces.

|Parameter|[Type](/manual/api/reference_commentary#data_types)|Beschrijving|
|--|--|------|
|**hostid**<br>(vereist)|string|ID van de host die moet worden bijgewerkt.|
|**interfaces**<br>(vereist)|object/array|[Hostinterfaces](/manual/api/reference/hostinterface/object) om de huidige hostinterfaces te vervangen.|

[comment]: # ({/5ad866d6-f5cf0b40})

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

`(object)` Retourneert een object dat de ID's van de gemaakte host bevat
interfaces onder de eigenschap `interfaceids`.

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

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

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

[comment]: # ({7bb6e122-98e67db1})
#### Hostinterfaces vervangen

Vervang alle hostinterfaces door een enkele agentinterface.

Verzoek:

```json
{
    "jsonrpc": "2.0",
    "method": "hostinterface.replacehostinterfaces",
    "params": {
        "hostid": "30052",
        "interfaces": {
            "dns": "",
            "ip": "127.0.0.1",
            "main": 1,
            "port": "10050",
            "type": 1,
            "useip": 1
        }
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}
```

Antwoord:

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

[comment]: # ({/7bb6e122-98e67db1})

[comment]: # ({272c42ef-272c42ef})
### Zie ook

- [host.update](/manual/api/referentie/host/update)
- [host.massupdate](/manual/api/reference/host/massupdate)

[comment]: # ({/272c42ef-272c42ef})

[comment]: # ({9d1e0b55-9d1e0b55})
### Bron

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

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