
# 获取SSL证书列表 - ListCertificatesV2
#### 功能介绍
获取SSL证书列表。
#### 调用方法
请参见[如何调用API](https://support.huaweicloud.com/api-apig/apig-api-180713003.html)。
#### 授权信息
账号具备所有API的调用权限，如果使用账号下的IAM用户调用当前API，该IAM用户需具备调用API所需的权限。
- 如果使用角色与策略授权，具体权限要求请参见[权限和授权项](https://support.huaweicloud.com/api-apig/apig-api-grant-policy_0000.html)。
- 如果使用身份策略授权，需具备如下身份策略权限。
  
  | 授权项                   | 访问级别 | 资源类型（\*为必须） | 条件键                       | 别名 | 依赖的授权项 |
  |:---|:---|:---|:---|:---|:---|
  | apig:certificate:list | List | instance    | g:ResourceTag/\<tag-key\> | -  | -      |
     
  
 
#### URI
GET /v2/{project_id}/apigw/certificates
表1路径参数 
| 参数         | 是否必选 | 参数类型   | 描述                                                                                      |
|:---|:---|:---|:---|
| project_id | 是    | String | 项目ID，获取方式请参见[获取项目ID](https://support.huaweicloud.com/api-apig/apig-api-180713009.html)。 |
   
表2Query参数 
| 参数                  | 是否必选 | 参数类型    | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
|:---|:---|:---|:---|
| offset              | 否    | Long    | 偏移量，表示从此偏移量开始查询，偏移量小于0时，自动转换为0 缺省值：**0**                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| limit               | 否    | Integer | 每页显示的条目数量，条目数量小于等于0时，自动转换为20，条目数量大于500时，自动转换为500 最小值：**1** 最大值：**500** 缺省值：**20**                                                                                                                                                                                                                                                                                                                      |
| name                | 否    | String  | 证书名称                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| common_name         | 否    | String  | 证书域名                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| signature_algorithm | 否    | String  | 证书签名算法                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| type                | 否    | String  | 证书类型。 - instance：实例证书   - global：全局证书                                                                                                                                |
| instance_id         | 是    | String  | 证书所属实例ID                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| algorithm_type      | 否    | String  | 证书算法类型。 - RSA   - ECC   - SM2    |
   
#### 请求参数
表3请求Header参数 
| 参数           | 是否必选 | 参数类型   | 描述                                                       |
|:---|:---|:---|:---|
| X-Auth-Token | 是    | String | 用户Token。通过调用IAM服务获取用户Token接口获取（响应消息头中X-Subject-Token的值）。 |
   
#### 响应参数
**状态码：200**
表4响应Body参数 
| 参数    | 参数类型                                                                | 描述        |
|:---|:---|:---|
| size  | Integer                                                             | 本次返回的列表长度 |
| total | Long                                                                | 满足条件的记录数  |
| certs | Array of [CertBase] objects | 证书基本内容    |
   
 表5CertBase 
| 参数                     | 参数类型             | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
|:---|:---|:---|
| id                     | String           | 证书ID                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| name                   | String           | 证书名称                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| type                   | String           | 证书类型 - global：全局证书   - instance：实例证书                                                                                                                                 |
| instance_id            | String           | 实例编码 - *type* 为*global*时，缺省为common   - *type* 为*instance*时，为实例编码                                                                                                     |
| project_id             | String           | 租户项目编号                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| common_name            | String           | 域名                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| san                    | Array of strings | san扩展域名                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| not_after              | String           | 有效期到                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| signature_algorithm    | String           | 签名算法                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| create_time            | String           | 创建时间                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| update_time            | String           | 更新时间                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| is_has_trusted_root_ca | Boolean          | 是否存在信任的根证书CA。当绑定证书存在trusted_root_ca时为true。 缺省值：**false**                                                                                                                                                                                                                                                                                                                                                                                                                           |
| algorithm_type         | String           | 证书算法类型： - RSA   - ECC   - SM2    |
   
**状态码：400**
表6响应Body参数 
| 参数         | 参数类型   | 描述   |
|:---|:---|:---|
| error_code | String | 错误码  |
| error_msg  | String | 错误描述 |
   
**状态码：401**
表7响应Body参数 
| 参数         | 参数类型   | 描述   |
|:---|:---|:---|
| error_code | String | 错误码  |
| error_msg  | String | 错误描述 |
   
**状态码：403**
表8响应Body参数 
| 参数         | 参数类型   | 描述   |
|:---|:---|:---|
| error_code | String | 错误码  |
| error_msg  | String | 错误描述 |
   
**状态码：500**
表9响应Body参数 
| 参数         | 参数类型   | 描述   |
|:---|:---|:---|
| error_code | String | 错误码  |
| error_msg  | String | 错误描述 |
   
#### 请求示例
无
#### 响应示例
**状态码：200**
OK
```
{
  "total" : 1,
  "size" : 1,
  "certs" : [ {
    "id" : "a27be832f2e9441c8127fe48e3b5ac67",
    "name" : "cert_demo",
    "type" : "instance",
    "project_id" : "73d69ae0cfcf460190522d06b60f05ad",
    "instance_id" : "f0fa1789-3b76-433b-a787-9892951c620e",
    "common_name" : "apigtest.example.com",
    "san" : [ "apigtest.example.com", "*.san.com" ],
    "not_after" : "2021-04-26T09:03:30Z",
    "signature_algorithm" : "SHA256-RSA",
    "create_time" : "2021-08-26T07:27:06.304004Z",
    "update_time" : "2021-08-26T07:27:06.304004Z",
    "algorithm_type" : "RSA"
  } ]
}
```
**状态码：400**
Bad Request
```
{
  "error_code" : "APIG.2012",
  "error_msg" : "Invalid parameter value,parameterName:dict_name. Please refer to the support documentation"
}
```
**状态码：401**
Unauthorized
```
{
  "error_code" : "APIG.1002",
  "error_msg" : "Incorrect token or token resolution failed"
}
```
**状态码：403**
Forbidden
```
{
  "error_code" : "APIG.1005",
  "error_msg" : "No permissions to request this method"
}
```
**状态码：500**
Internal Server Error
```
{
  "error_code" : "APIG.9999",
  "error_msg" : "System error"
}
```
#### 状态码
| 状态码 | 描述                    |
|:---|:---|
| 200 | OK                    |
| 400 | Bad Request           |
| 401 | Unauthorized          |
| 403 | Forbidden             |
| 500 | Internal Server Error |
   
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-apig/ErrorCode.html)。
