[comment]: # ({991d071b-991d071b})
# 清理

[comment]: # ({/991d071b-991d071b})

[comment]: # ({7c7c67ac-3bf9d0da})
### 描述

`object history.clear(array itemids)`

这个方法用于清理监控项的历史数据。

::: noteclassic
这个方法只适用于 *管理员* 和 *超级管理员* 的用户类型。调用该方法的权限可以在用户角色设置中被撤销。 前往[用户角色](/manual/web_interface/frontend_sections/users/user_roles)以了解更多信息。
:::

[comment]: # ({/7c7c67ac-3bf9d0da})

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

`(array)` 需要清理历史数据的监控项ID。

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

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

`(object)` 返回一个包含 `itemids` 属性（其中包含成功清除历史数据的监控项ID）的对象。

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

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

### 示例

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

[comment]: # ({c73cef81-e482fed3})
#### 清理历史数据

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

```json
{
    "jsonrpc": "2.0",
    "method": "history.clear",
    "params": [
        "10325",
        "13205"
    ],
    "id": 1
}
```

响应:

```json
{
    "jsonrpc": "2.0",
    "result": {
        "itemids": [
            "10325",
            "13205"
        ]
    },
    "id": 1
}
```

[comment]: # ({/c73cef81-e482fed3})

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

CHistory::clear() in *ui/include/classes/api/services/CHistory.php*.

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