[comment]: # translation:outdated

[comment]: # ({8703e8df-8703e8df})
# 批量删除

[comment]: # ({/8703e8df-8703e8df})

[comment]: # ({626e115a-bcf1ded4})
### 描述

`object hostgroup.massremove(object parameters)`

这种方法可以从多个主机组中删除相关对象。

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

[comment]: # ({/626e115a-bcf1ded4})

[comment]: # ({6e272bdb-6b7b7475})
### 参数

`(object)` 参数，其中包含要更新的主机组 ID 和要删除的对象。

|参数|[类型](/manual/api/reference_commentary#data_types)|说明|
|--|--|------|
|groupids|ID/array|要更新的主机组 ID。<br><br>[参数行为](/manual/api/reference_commentary#parameter-behavior):<br>- *必须*|
|hostids|ID/array|要从所有主机组移除的 [主机](/manual/api/reference/host/object) 的 ID。|

[comment]: # ({/6e272bdb-6b7b7475})

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

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

[comment]: # ({/736f3b05-736f3b05})

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

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

[comment]: # ({31b87672-cf36d4e8})
#### 从主机组中删除主机

从给定的主机组中删除两个主机。

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

```json
{
    "jsonrpc": "2.0",
    "method": "hostgroup.massremove",
    "params": {
        "groupids": [
            "5",
            "6"
        ],
        "hostids": [
            "30050",
            "30001"
        ]
    },
    "id": 1
}
```

响应：

```json
{
    "jsonrpc": "2.0",
    "result": {
        "groupids": [
            "5",
            "6"
        ]
    },
    "id": 1
}
```

[comment]: # ({/31b87672-cf36d4e8})

[comment]: # ({3700b99d-3700b99d})
### 来源

CHostGroup::massRemove() 在
*ui/include/classes/api/services/CHostGroup.php*.

[comment]: # ({/3700b99d-3700b99d})
