# pluginManager.applyPlugin
Call this API at the server side. For more information, see Server API.
This API supports Cloud Calls. The WeChat DevTools version must be
1.02.1904090
or later (download the latest stable version here), and thewx-server-sdk
version must be0.4.0
or later.
Sends a plug-in use request to the plug-in developer.
Calling methods:
# HTTPS Call
# Request Address
POST https://api.weixin.qq.com/wxa/plugin?access_token=TOKEN
# Request Parameters
Attribute | Type | Default | Required | Description |
---|---|---|---|---|
access_token | string | Yes | Credentials to call API | |
action | string | Yes | Enter "apply" in this API. | |
plugin_appid | string | Yes | The AppID of the plug-in. | |
reason | string | No | The reason for the application |
# Return Value
# Object
JSON data package that is returned
Attribute | Type | Description |
---|---|---|
errcode | number | Error code |
errmsg | string | Error message |
# Errors
Error Code | Error Message | Description |
---|---|---|
0 | ok | Normal |
-1 | System error | |
89236 | This plug-in is not available for application. | |
89237 | This plug-in has been added. | |
89238 | The upper limit of plug-ins that are being applied for or in use is exceeded. | |
89239 | The plug-in does not exist. | |
89240 | Cannot perform this operation. Only "Pending" requests can be approved/rejected. | |
89241 | Cannot perform this operation. Only "Rejected/Timed Out" requests can be deleted. | |
89242 | This AppID is not in the request list. | |
89243 | "Pending" requests cannot be deleted. | |
89044 | The AppID of this plug-in does not exist. |
# Request Data Example
{
"action": "apply",
"plugin_appid": "aaaa",
"reason": "hello"
}
# Cloud Call
Cloud call is a capability provided by Mini Program·Cloud Base that allows you to call WeChat APIs in a cloud function. It must be used via
wx-server-sdk
in the cloud function.
# API Calling Method
openapi.pluginManager.applyPlugin
You need to configure the permissions for the
pluginManager.applyPlugin
API viaconfig.json
. Details
# Request Parameters
Attribute | Type | Default | Required | Description |
---|---|---|---|---|
action | string | Yes | Enter "apply" in this API. | |
pluginAppid | string | Yes | The AppID of the plug-in. | |
reason | string | No | The reason for the application |
# Return Value
# Object
JSON data package that is returned
Attribute | Type | Description |
---|---|---|
errCode | number | Error code |
errMsg | string | Error message |
# Exceptions
# Object
Thrown Exceptions
Property | Type | Description |
---|---|---|
errCode | number | Error code |
errMsg | string | Error message |
Valid values of errCode
Value | Description | Minimum Version |
---|
# Errors
Error Code | Error Message | Description |
---|---|---|
0 | ok | Normal |
-1 | System error | |
89236 | This plug-in is not available for application. | |
89237 | This plug-in has been added. | |
89238 | The upper limit of plug-ins that are being applied for or in use is exceeded. | |
89239 | The plug-in does not exist. | |
89240 | Cannot perform this operation. Only "Pending" requests can be approved/rejected. | |
89241 | Cannot perform this operation. Only "Rejected/Timed Out" requests can be deleted. | |
89242 | This AppID is not in the request list. | |
89243 | "Pending" requests cannot be deleted. | |
89044 | The AppID of this plug-in does not exist. |
# Request Data Example
const cloud = require('wx-server-sdk')
cloud.init()
exports.main = async (event, context) => {
try {
const result = await cloud.openapi.pluginManager.applyPlugin({
action: 'apply',
reason: 'hello',
pluginAppid: 'aaaa'
})
console.log(result)
return result
} catch (err) {
console.log(err)
return err
}
}