# 查询实例大版本升级检查历史（PostgreSQL） - ListInspectionHistories
#### 功能介绍
查询实例大版本升级检查历史。
- 调用接口前，您需要了解API[认证鉴权](https://support.huaweicloud.com/api-rds/rds_03_0001.html)。
- 调用接口前，您需要了解[请求Header参数说明](https://support.huaweicloud.com/api-rds/rds_03_0005.html#rds_03_0005__section479119143310)。
 
#### 调试
您可以在[API Explorer](https://console.huaweicloud.com/apiexplorer/#/openapi/RDS/doc?api=ListInspectionHistories)中调试该接口。
#### 授权信息
账号具备所有API的调用权限，如果使用账号下的IAM用户调用当前API，该IAM用户需具备调用API所需的权限。
- 如果使用角色与策略授权，具体权限要求请参见[权限和授权项](https://support.huaweicloud.com/api-rds/rds_10_0005.html)。
- 如果使用身份策略授权，需具备如下身份策略权限。
 
| 授权项                      | 访问级别   | 资源类型（\*为必须） | 条件键 | 别名                | 依赖的授权项 |
|:---|:---|:---|:---|:---|:---|
| rds:instance:listAll | read | -           | -   | rds:instance:list | -      |
   
#### 接口约束
- 该接口仅支持PostgreSQL引擎。
- 实例在创建、变更规格、修改端口、冻结、异常等状态下不能执行该操作。
 
#### URI
- URI格式 GET /v3/{project_id}/instances/{instance_id}/major-version/inspection-histories?offset={offset}\&limit={limit}\&order={order}\&sort_field={sort_field}\&target_version={target_version}\&is_available={is_available}
  
- 参数说明
  表1参数说明 
  | 名称               | 参数类型      | 是否必选 | 说明                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
  |:---|:---|:---|:---|
  | project_id       | String    | 是   | **参数解释：** 租户在某一region下的project ID。 获取方法请参见[获取项目ID](https://support.huaweicloud.com/api-rds/rds_03_0002.html)。 **约束限制：** 不涉及。 **取值范围：** 不涉及。 **默认取值：** 不涉及。                                                                                |
  | instance_id     | String  | 是     | **参数解释：** 实例ID。 可调用[查询数据库实例列表](https://support.huaweicloud.com/api-rds/rds_01_0004.html)接口，通过[表4](https://support.huaweicloud.com/api-rds/rds_01_0004.html#rds_01_0004__table2058713718267)中的"id"获取。 **约束限制：** 不涉及。 **取值范围：** 不涉及。 **默认取值：** 不涉及。 |
  | offset            | Integer   | 否     | **参数解释**： 索引位置，偏移量。表示从第一条数据偏移offset条数据后开始查询。 **约束限制**： 不涉及。 **取值范围**： 大于等于0的整数。 **默认取值：** 默认为0，表示偏移0条数据，即从第一条数据开始查询。                                                                                                                                                                                                                                                                                                                                                                                                                             |
  | limit          | Integer  | 否     | **参数解释**： 查询记录数。 **约束限制：** 不涉及。 **取值范围：** \[1, 100\] **默认取值：** 10                                                                                                                                                                                                                                                                                                                                                                                                                                          |
  | order             | String    | 否     | **参数解释**： 排序方式。 **约束限制：** 不涉及。 **取值范围：** - DESC：降序。  - ASC：升序。   **默认取值：** DESC                                                                                                                                                                              |
  | sort_field        | String   | 否    | **参数解释**： 排序字段。 **约束限制：** 不涉及。 **取值范围：** - check_time：检查时间。  - expiration_time：过期时间。   **默认取值：** check_time                                                                                                                                                |
  | target_version | String    | 否    | **参数解释**： 目标版本。 **约束限制：** 不涉及。 **取值范围：** 不涉及。 **默认取值：** 不涉及。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
  | is_available   | Boolean | 否    | **参数解释**： 是否有效。 **约束限制：** 不涉及。 **取值范围：** - true：表示有效。  - false：表示无效。   **默认取值：** 不涉及。                                                                                                                                                                               |
     
  
 
#### 请求消息
- 请求参数 无。
  
- URI样例
  ```
  https://{Endpoint}/v3/0483b6b16e954cb88930a360d2c4e663/instances/3aa441c4c98a4b36b100a7e3e87d17cein03/major-version/inspection-histories?offset=0&limit=10
  ```
  
 
#### 响应消息
- 正常响应要素说明
  表2参数说明 
  | 名称               | 参数类型              | 说明                                                                                                                                                                                |
  |:---|:---|:---|
  | total_count       | Integer           | **参数解释**： 总记录数。 **取值范围：** 不涉及。                                                           |
  | inspection_reports | Array of objects | **参数解释**： 检查报告信息。 详情请参见[表3]。 |
     
   表3inspection_report字段数据结构说明 
  | 名称                | 参数类型     | 说明                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
  |:---|:---|:---|
  | id              | String   | **参数解释**： 检查报告ID。 **取值范围：** 不涉及。                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
  | check_time        | String   | **参数解释**： 检查时间，格式为"yyyy-mm-ddThh:mm:ssZ"。 其中，T指某个时间的开始；Z指时区偏移量，例如偏移1个小时显示为+0100。 **取值范围：** 不涉及。                                                                                                                                                                                                                                                                                                                              |
  | expiration_time | String | **参数解释**： 到期时间，格式为"yyyy-mm-ddThh:mm:ssZ"。 其中，T指某个时间的开始；Z指时区偏移量，例如偏移1个小时显示为+0100。 **取值范围：** 不涉及。                                                                                                                                                                                                                                                                                                                                   |
  | target_version  | String  | **参数解释**： 目标版本。 **取值范围：** 不涉及。                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
  | result            | String | **参数解释**： 检查结果。 **取值范围：** - success：表示成功。  - failed：表示失败。  - running：表示检查中。   |
  | detail           | String  | **参数解释**： 检查报告详情。 **取值范围：** 不涉及。                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
     
  

- 正常响应样例
  ```
  {
           "total_count": 1,
           "inspection_reports": [
                    {
                              "id": "289903e1-3006-19e9-e054-5fb7fe376552",
                              "check_time": "2023-03-06T02:33:49+0800",
                              "expiration_time": "2023-03-07T02:33:49+0800",
                              "target_version": "14.4",        
                              "result": "success",
                              "detail": "2023-03-06 18:33:26 --- pg_upgrade check task                              begin\n2023-03-06 18:34:40 --- pg_upgrade check on master:                       [user_check_report]User check success"
                    }
           ]
  }
  ```
  

- 异常响应 请参见[异常响应结果](https://support.huaweicloud.com/api-rds/rds_01_0010.html)。
  
 
#### 状态码
- 正常 200
  
- 异常 请参见[状态码](https://support.huaweicloud.com/api-rds/rds_10_0200.html)。
  
 
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-rds/rds_10_0201.html)。
