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

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

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

`object hostinterface.replacehostinterfaces(object parameters)`

Šī metode ļauj aizstāt visas hosta saskarnes norādītajā hostā.

::: noteclassic
Šī metode ir pieejama tikai *Admin* un *Super admin*
lietotāju tipiem. Tiesības izsaukt šo metodi var atsaukt lietotāju lomu
iestatījumos. Plašāku informāciju skatiet sadaļā [Lietotāju
lomas](/manual/web_interface/frontend_sections/users/user_roles).
:::

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

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

`(object)` Parametri, kas satur hosta ID, kas jāatjaunina, un
jaunās hosta saskarnes.

|Parameter|[Type](/manual/api/reference_commentary#data_types)|Description|
|--|--|------|
|interfaces|object/array|[Host saskarnes](/manual/api/reference/hostinterface/object), ar kurām aizstāt pašreizējās hosta saskarnes.<br><br>[Parametra uzvedība](/manual/api/reference_commentary#parameter-behavior):<br>- *required*|
|hostid|ID|Atjaunināmā hosta ID.<br><br>[Parametra uzvedība](/manual/api/reference_commentary#parameter-behavior):<br>- *required*|

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

[comment]: # ({88283807-88283807})
### Atgrieztās vērtības

`(object)` Atgriež objektu, kas satur izveidoto hostu saskarņu ID zem `interfaceids` īpašības.

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

[comment]: # ({b41637d2-b41637d2})
### Piemēri

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

[comment]: # ({01fd5e38-98e67db1})
#### Hosts saskarņu aizstāšana

Aizstājiet visas hosts saskarnes ar vienu aģenta saskarni.

[Pieprasījums](/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
}
```

Atbilde:

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

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

[comment]: # ({272c42ef-272c42ef})
### Skatīt arī

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

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

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

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

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