[comment]: # translation:outdated

[comment]: # ({dd2b9519-dd2b9519})
# 删除

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

[comment]: # ({4fc1750c-8f1cd3fa})
### 描述

`object host.delete(array hosts)`

这个方法用于删除主机。

::: noteclassic
这个方法仅适用 *管理员* 和 *超级管理员* 用户类型。可以在用户角色中撤销调用方法的权限设置。参考[用户角色](/manual/web_interface/frontend_sections/users/user_roles)获取详情。
:::

[comment]: # ({/4fc1750c-8f1cd3fa})

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

`(array)` 要删除主机的ID。

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

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

`(object)` 返回一个在 `hostids` 属性下包含已删除主机ID的对象。

[comment]: # ({/54b4a855-54b4a855})

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

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

[comment]: # ({47a8da31-ef767d02})
#### 删除多个主机

删除两个主机。

[请求](/manual/api#执行请求):

```json
{
    "jsonrpc": "2.0",
    "method": "host.delete",
    "params": [
        "13",
        "32"
    ],
    "id": 1
}
```

响应:

```json
{
    "jsonrpc": "2.0",
    "result": {
        "hostids": [
            "13",
            "32"
        ]
    },
    "id": 1
}
```

[comment]: # ({/47a8da31-ef767d02})

[comment]: # ({9d5f3989-9d5f3989})
### 源码

CHost::delete() in *ui/include/classes/api/services/CHost.php*.

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