[comment]: # translation:outdated

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

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

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

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

这种方法可以更新现有的主机接口。

::: noteclassic
此方法仅适用于 *Admin* 和 *Super admin* 用户类型。调用该方法的权限可在用户角色设置中撤销。更多信息请参阅 [用户角色](/manual/web_interface/frontend_sections/users/user_roles)。
:::

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

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

`(object/array)` 要更新的 [主机接口属性](object#host_interface)。

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

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

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

`(object)` 返回一个对象，其中在 `interfaceids` 属性下包含更新的主机接口 ID。

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

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

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

[comment]: # ({d6135bbd-eb8b35e8})
#### 更改一个主机接口端口

更改主机接口的端口。

[请求](/manual/api#performing-requests)：

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

响应：

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

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

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

CHostInterface::update() 在
*ui/include/classes/api/services/CHostInterface.php*。

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