
# 查询插件列表 - ListPlugins
#### 功能介绍
查询一组符合条件的API网关插件详情。
- 支持分页
  
- 支持根据插件类型查询
  
- 支持根据插件可见范围查询
  
- 支持根据插件编码查询
  
- 支持根据名称模糊查询
  
 
#### 调用方法
请参见[如何调用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:plugin:list | List | instance \* | g:ResourceTag/\<tag-key\> | apig:plugins:list | apig:instance:get |
     
  
 
#### URI
GET /v2/{project_id}/apigw/instances/{instance_id}/plugins
表1路径参数 
| 参数          | 是否必选 | 参数类型   | 描述                                                                                      |
|:---|:---|:---|:---|
| project_id  | 是    | String | 项目ID，获取方式请参见[获取项目ID](https://support.huaweicloud.com/api-apig/apig-api-180713009.html)。 |
| instance_id | 是    | String | 实例ID，在API网关控制台的"实例信息"中获取。                                                               |
   
表2Query参数 
| 参数             | 是否必选 | 参数类型    | 描述                                                                                                                                                                             |
|:---|:---|:---|:---|
| offset         | 否    | Long    | 偏移量，表示从此偏移量开始查询，偏移量小于0时，自动转换为0 缺省值：**0**                                                                                                        |
| limit          | 否    | Integer | 每页显示的条目数量，条目数量小于等于0时，自动转换为20，条目数量大于500时，自动转换为500 最小值：**1** 最大值：**500** 缺省值：**20** |
| plugin_type    | 否    | String  | 插件类型                                                                                                                                                                           |
| plugin_scope   | 否    | String  | 插件可见范围                                                                                                                                                                         |
| plugin_id      | 否    | String  | 插件编码                                                                                                                                                                           |
| plugin_name    | 否    | String  | 插件名称，支持模糊查询                                                                                                                                                                    |
| precise_search | 否    | String  | 指定需要精确匹配查找的参数名称，目前支持插件名称                                                                                                                                                       |
   
#### 请求参数
表3请求Header参数 
| 参数           | 是否必选 | 参数类型   | 描述                                                       |
|:---|:---|:---|:---|
| X-Auth-Token | 是    | String | 用户Token。通过调用IAM服务获取用户Token接口获取（响应消息头中X-Subject-Token的值）。 |
   
#### 响应参数
**状态码：200**
表4响应Body参数 
| 参数      | 参数类型                                                             | 描述        |
|:---|:---|:---|
| size    | Integer                                                          | 本次返回的列表长度 |
| total   | Long                                                             | 满足条件的记录数  |
| plugins | Array of [PluginInfo] objects | 插件列表。     |
   
 表5PluginInfo 
| 参数             | 参数类型   | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
|:---|:---|:---|
| plugin_id      | String | 插件编码。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| plugin_name    | String | 插件名称。支持汉字，英文，数字，中划线，下划线，且只能以英文和汉字开头，3-255字符。 说明： 中文字符必须为UTF-8或者unicode编码。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| plugin_type    | String | 插件类型。 - cors：跨域资源共享   - set_resp_headers：HTTP响应头管理   - kafka_log：Kafka日志推送   - breaker：断路器   - rate_limit: 流量控制   - third_auth: 第三方认证   - proxy_cache: 响应缓存   - proxy_mirror: 请求镜像   - oidc_auth: OIDC认证   - jwt_auth: JWT认证                            |
| plugin_scope   | String | 插件可见范围。global：全局可见；                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| plugin_content | String | 插件定义内容，支持json。参考提供的具体模型定义 [CorsPluginContent](https://support.huaweicloud.com/api-apig/apig-api-CorsPluginContent.html)：跨域资源共享 定义内容 [SetRespHeadersContent](https://support.huaweicloud.com/api-apig/apig-api-SetRespHeadersContent.html)：HTTP响应头管理 定义内容 [KafkaLogContent](https://support.huaweicloud.com/api-apig/apig-api-KafkaLogContent.html)：Kafka日志推送 定义内容 [BreakerContent](https://support.huaweicloud.com/api-apig/apig-api-BreakerContent.html)：断路器 定义内容 [RateLimitContent](https://support.huaweicloud.com/api-apig/apig-api-RateLimitContent.html)：流量控制 定义内容 [ThirdAuthContent](https://support.huaweicloud.com/api-apig/apig-api-ThirdAuthContent.html)：第三方认证 定义内容 [ProxyCacheContent](https://support.huaweicloud.com/api-apig/apig-api-ProxyCacheContent.html)：响应缓存 定义内容 [ProxyMirrorContent](https://support.huaweicloud.com/api-apig/apig-api-ProxyMirrorContent.html)：请求镜像 定义内容 [OIDCAuthResp](https://support.huaweicloud.com/api-apig/apig-api-OIDCAuthContent.html)：OIDC认证 定义内容 [JWTAuthContent](https://support.huaweicloud.com/api-apig/apig-api-JWTAuthContent.html)：JWT认证 定义内容 最大长度：**65535** |
| remark         | String | 插件描述，255字符。 说明： 中文字符必须为UTF-8或者unicode编码。 最大长度：**255**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| create_time    | String | 创建时间。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| update_time    | String | 更新时间。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
   
**状态码：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,
  "plugins" : [ {
    "plugin_id" : "5b729aa252764739b3s237ef0d66dc63",
    "plugin_name" : "跨域插件",
    "plugin_type" : "cors",
    "plugin_scope" : "global",
    "plugin_content" : "{\"allow_origin\": \"*\",\"allow_methods\": \"GET,POST,PUT\",\"allow_headers\": \"Content-Type,Accept,Accept-Ranges,Cache-Control\",\"expose_headers\": \"X-Request-Id,X-Apig-Latency\",\"max_age\": 172800,\"allow_credentials\": true}",
    "remark" : "CORS跨域资源访问",
    "create_time" : "2022-11-02T12:31:23.353Z",
    "update_time" : "2022-11-02T12:31:23.353Z"
  } ]
}
```
**状态码：400**
Bad Request
```
{
  "error_code" : "APIG.2012",
  "error_msg" : "Invalid parameter value,parameterName:plugin_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)。
