This API should be called on the server side and cannot be called directly on the client side (Mini Program, web page, APP, etc.). For details, please refer to API Call Guide.
API English Name: getRecentAverageUsage
Mini Program can use this API to query the average usage of a specific paid feature over the last three months.
1. Call Method
HTTPS Call
GET https://api.weixin.qq.com/wxa/charge/usage/get_recent_average?access_token=ACCESS_TOKEN
Cloud Call
- This API does not support cloud call.
Third-party Call
-
This API supports third-party platforms on behalf of Merchant call.
-
The permission set ID of this API is: 18
-
After the service provider obtains one of the permission set authorizations, it can use authorizer_access_token to call on behalf of Merchant, for details please refer to Third-party Call documentation.
2. Request Parameters
Query Parameters Query String Parameters
| Parameter | Type | Required | Example | Description |
|---|---|---|---|---|
| access_token | string | Yes | ACCESS_TOKEN | API call credential, you can use access_token, authorizer_access_token |
Request Body Request Payload
| Parameter | Type | Required | Description |
|---|---|---|---|
| spuId | string | Yes | Product SPU ID |
3. Response Parameters
Response Body Response Payload
| Parameter | Type | Description |
|---|---|---|
| errcode | number | Error Code |
| errmsg | string | Error Message |
| averageData | number | Average monthly usage, which has been obfuscated and is not an exact value. Note: When the return value of `averageData` is 50, it means the recent average usage for Mini Program is less than or equal to 50 times/month, not specifically exactly 50 times per month. |
4. Notes
No special notes for this API
5. Code Example
Request Example
GET https://api.weixin.qq.com/wxa/charge/usage/get_recent_average?access_token=ACCESS_TOKEN&spuId=10000077
Response Example
{
"errcode": 0,
"errmsg": "ok",
"averageData": 260000
}
6. Error Codes
The following is the error code list of this API, other error codes can refer to Common Error Codes; When encountering errors in calling the API, you can use the official API Diagnostic Tool to assist in locating and analyzing problems.
| Error Code | Error Description |
|---|---|
| 10120002 | Invalid parameters |
| 10120700 | Invalid `spuId` |
| 10122000 | No recent usage data available for this product |
7. Applicable Scope
This API supports 「Mini Program」 account type calls. Other account types cannot call unless otherwise specified.