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

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

[comment]: # ({e440e997-f14e7778})
### Opis

`object hostinterface.replacehostinterfaces(object parameters)`

Ta metoda umożliwia zastąpienie wszystkich interfejsów hosta na wskazanym hoście.

::: noteclassic
Ta metoda jest dostępna tylko dla typów użytkowników *Admin* i *Super admin*.
Uprawnienia do wywołania tej metody można cofnąć w ustawieniach roli użytkownika.
Więcej informacji można znaleźć w sekcji [Role użytkowników](/manual/web_interface/frontend_sections/users/user_roles).
:::

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

[comment]: # ({233510b8-f5cf0b40})
### Parametry

`(object)` Parametry zawierające ID hosta do zaktualizowania oraz
nowe interfejsy hosta.

|Parameter|[Type](/manual/api/reference_commentary#data_types)|Description|
|--|--|------|
|interfaces|object/array|[Interfejsy hosta](/manual/api/reference/hostinterface/object) do zastąpienia bieżących interfejsów hosta.<br><br>[Zachowanie parametru](/manual/api/reference_commentary#parameter-behavior):<br>- *wymagany*|
|hostid|ID|ID hosta do zaktualizowania.<br><br>[Zachowanie parametru](/manual/api/reference_commentary#parameter-behavior):<br>- *wymagany*|

[comment]: # ({/233510b8-f5cf0b40})

[comment]: # ({88283807-88283807})
### Zwracane wartości

`(object)` Zwraca obiekt zawierający identyfikatory utworzonych interfejsów hosta w właściwości `interfaceids`.

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

[comment]: # ({b41637d2-b41637d2})
### Przykłady

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

[comment]: # ({01fd5e38-98e67db1})
#### Zastępowanie interfejsów hosta

Zastąp wszystkie interfejsy hosta jednym interfejsem agent.

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

```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
        }
    },
    "id": 1
}
```

Response:

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

[comment]: # ({/01fd5e38-98e67db1})

[comment]: # ({272c42ef-272c42ef})
### Zobacz także

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

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

[comment]: # ({9d1e0b55-9d1e0b55})
### Źródło

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

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