[comment]: # translation:outdated

[comment]: # ({9230837a-9230837a})
# 批量删除

[comment]: # ({/9230837a-9230837a})

[comment]: # ({0ea2aabb-4559aff6})
### 描述

`object hostinterface.massremove(object parameters)`

该方法允许从给定的主机列表中批量删除主机接口

::: noteclassic
该方法适用于*管理员*和*超级管理员*用户类型。可以在用户角色设置中撤销调用该方法的权限。有关详细信息，参阅[用户角色](/manual/web_interface/frontend_sections/administration/user_roles)。
:::

[comment]: # ({/0ea2aabb-4559aff6})

[comment]: # ({21d50f52-8970fdbb})
### 参数

`(object)` 参数包含更新的主机的ID和被删除的主机接口。

|参数|[类型](/manual/api/reference_commentary#data_types)|描述|
|---------|---------------------------------------------------|-----------|
|**hostids**<br>(必选)|字符串/数组|被更新的主机ID|
|**interfaces**<br>(必选)|对象/数组|要删除的给定主机接口<br><br>主机接口对象必须定义ip, dns 和port属性。|

[comment]: # ({/21d50f52-8970fdbb})

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

`(object)` 在`interfaceids`属性中返回已删除主机接口ID的对象。

[comment]: # ({/61a8b976-61a8b976})

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

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

[comment]: # ({d774331b-cceffaf2})
#### 删除接口

从两台主机中删除 "127.0.0.1" SNMP接口。

请求:

```json
{
    "jsonrpc": "2.0",
    "method": "hostinterface.massremove",
    "params": {
        "hostids": [
            "30050",
            "30052"
        ],
        "interfaces": {
            "dns": "",
            "ip": "127.0.0.1",
            "port": "161"
        }
    },
    "auth": "038e1d7b1735c6a5436ee9eae095879e",
    "id": 1
}
```

响应:

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

[comment]: # ({/d774331b-cceffaf2})

[comment]: # ({a3245281-a3245281})
### 参考

-   [hostinterface.delete](delete)
-   [host.massremove](/manual/api/reference/host/massremove)

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

[comment]: # ({6853cf7a-6853cf7a})
### 来源

CHostInterface::massRemove() in
*ui/include/classes/api/services/CHostInterface.php*。

[comment]: # ({/6853cf7a-6853cf7a})
