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

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

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

`object hostinterface.replacehostinterfaces(object parameters)`

Ta metoda pozwala na zastąpienie wszystkich interfejsów hosta na określonym hoście.

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

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

[comment]: # ({ad328eba-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>- *required*|
|hostid|ID|ID hosta do zaktualizowania.<br><br>[Zachowanie parametru](/manual/api/reference_commentary#parameter-behavior):<br>- *required*|

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

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

`(object)` Zwraca obiekt zawierający identyfikatory utworzonych interfejsów 
hosta we 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.

[Żądanie](/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
}
```

Odpowiedź:

```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})
