[comment]: # ({59b410c0-59b410c0})
# hostinterface.update

[comment]: # ({/59b410c0-59b410c0})

[comment]: # ({253ed57f-253ed57f})
### 描述

`object hostinterface.update(object/array hostInterfaces)`

此方法允许update现有的主机接口.

::: noteclassic
此方法仅适用于*管理员*和*超级管理员*用户类型. 调用该方法的权限可在用户角色设置中撤销. 更多信息请参阅[User
roles](/manual/web_interface/frontend_sections/administration/user_roles).

:::

[comment]: # ({/253ed57f-253ed57f})

[comment]: # ({a99ac0ad-a99ac0ad})
### 参数

`(object/array)` [主机接口](object#主机接口) 待更新.

每个主机接口必须定义`interfaceid`属性，其他所有属性均为可选。仅指定的属性会被更新，其余属性将保持不变。

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

[comment]: # ({d3be3202-d3be3202})
### 返回值

`(object)` 返回一个包含更新后的object接口ID的主机对象，这些ID位于`interfaceids`属性下。

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

[comment]: # ({b41637d2-b41637d2})
### 示例

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

[comment]: # ({9c8f9b56-eb8b35e8})
#### 更改主机接口端口

更改一个主机接口的端口.

请求:

```json
{
    "jsonrpc": "2.0",
    "method": "hostinterface.update",
    "params": {
        "interfaceid": "30048",
        "port": "30050"
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}
```
响应:

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

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

[comment]: # ({97e4c8d0-97e4c8d0})
### 来源

CHostInterface::update() 位于
*ui/include/classes/api/services/CHostInterface.php* 文件中.

[comment]: # ({/97e4c8d0-97e4c8d0})
