插件管理 /插件申请管理

# 插件申请管理

> 接口应在服务器端调用,详细说明参见[服务端API](https://developers.weixin.qq.com/miniprogram/dev/framework/server-ability/backend-api.html)。

> 本接口支持[云调用](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/guide/openapi/openapi.html)。需开发者工具版本 >= `1.02.1904090`(最新[稳定版下载](https://developers.weixin.qq.com/miniprogram/dev/devtools/stable.html)),`wx-server-sdk` >= `0.4.0`

## 接口说明

### 接口英文名

managePluginApplication

### 功能描述

该接口供插件开发者调用,用于获取当前所有插件使用方信息以及修改插件使用申请的状态

## 调用方式

### HTTPS 调用

```text
POST https://api.weixin.qq.com/wxa/devplugin?access_token=ACCESS_TOKEN 
```

### 云调用

- 出入参和 HTTPS 调用相同,调用方式可查看[云调用说明文档](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/guide/openapi/openapi.html)
- 接口方法为: openapi.pluginManager.getPluginDevApplyList

### 第三方调用

- 调用方式以及出入参和 HTTPS 相同,仅是调用的 token 不同
- 该接口所属的权限集 id 为:40
- 服务商获得其中之一权限集授权后,可通过使用[authorizer_access_token](https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/ThirdParty/token/api_authorizer_token.html)代商家进行调用

### 请求参数

| 属性                                  | 类型   | 必填 | 说明                                                         |
| :------------------------------------ | :----- | :--- | :----------------------------------------------------------- |
| access_token / cloudbase_access_token | string | 是   | 接口调用凭证,该参数为 URL 参数,非 Body 参数。access_token和cloudbase_access_token二选一 其中access_token可通过[getAccessToken](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/access-token/auth.getAccessToken.html)接口获得; 如果是第三方代调用请传入[authorizer_access_token](https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/ThirdParty/token/api_authorizer_token.html); cloudbase_access_token可通过[getOpenData](https://developers.weixin.qq.com/miniprogram/dev/wxcloudrun/src/guide/weixin/token.html)接口获得 |
| action                                | string | 是   | dev_agree表示同意申请、dev_refuse表示拒绝申请、dev_delete表示删除已拒绝的申请者、dev_apply_list表示获取当前所有插件使用方信息 |
| appid                                 | string | 否   | action为"dev_agree"时填写,使用者的 appid,同意申请时填写。  |
| page                                  | number | 否   | action为"dev_apply_list"时填写,要拉取第几页的数据           |
| num                                   | number | 否   | action为"dev_apply_list"时填写,每页的记录数                 |
| reason                                | string | 否   | action为"dev_refuse"时填写,拒绝理由。                       |

### 返回参数

|      | 属性                                                         | 类型          | 说明                                           |
| :--- | :----------------------------------------------------------- | :------------ | :--------------------------------------------- |
|      | errcode                                                      | number        | 错误码                                         |
|      | errmsg                                                       | string        | 错误信息                                       |
|      | apply_list                                                   | array<object> | 插件使用方列表,action为"dev_apply_list"时返回 |
|      | 属性类型说明appidstring使用者的appidstatusnumber插件状态nicknamestring使用者的昵称headimgurlstring使用者的头像reasonstring使用者的申请说明apply_urlstring使用者的小程序码create_timestring使用者的申请时间categoriesarray<object>使用者的类目属性类型说明firststring一级类目名称secondstring二级类目名称 |               |                                                |

## 调用示例

> 示例说明: 获取当前所有插件使用方示例

### 请求数据示例

```json
{
  "action":"dev_apply_list",
  "page": 1,
  "num": 10
} 
```

### 返回数据示例

```json
{
  "errcode": 0,
  "errmsg": "ok",
  "apply_list": [{
    "appid": "xxxxxxxxxxxxx",
    "status": 1,
    "nickname": "名称",
    "headimgurl": "**********",
    "reason": "polo has gone",
    "apply_url": "*******",
    "create_time": "1536305096",
    "categories": [{
      "first": "IT科技",
      "second": "硬件与设备"
    }]
  }]
} 
```

> 示例说明: 修改插件使用申请的状态示例

### 请求数据示例

```json
{
  "action": "dev_agree",
  "appid": "aaaa"
} 
```

### 返回数据示例

```json
{
  "errcode": 0,
  "errmsg": "ok"
} 
```

### 错误码

| 错误码 | 错误码取值                                              | 解决方案                                                     |
| :----- | :------------------------------------------------------ | :----------------------------------------------------------- |
| 40001  | invalid credential access_token isinvalid or not latest | 获取 access_token 时 AppSecret 错误,或者 access_token 无效。请开发者认真比对 AppSecret 的正确性,或查看是否正在为恰当的公众号调用接口 |

|      |      |      |
| :--- | :--- | :--- |
|      |      |      |
|      |      |      |
|      |      |      |