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: callbackCheck
To assist developers in troubleshooting callback connection failures, this network detection API is provided. It performs domain name resolution on the developer's URL and then sends a ping request to all IPs to obtain packet loss rates and latency.
1. Call Method
HTTPS Call
POST https://api.weixin.qq.com/cgi-bin/callback/check?access_token=ACCESS_TOKEN
Cloud Call
- This API does not support cloud call.
Third-party Call
-
This API supports third-party platforms to call using component_access_token, and also supports calling on behalf of Merchant call.
-
After the service provider obtains any permission set authorization, 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 | Description |
|---|---|---|---|
| access_token | string | Yes | API call credential, you can use access_token, component_access_token, authorizer_access_token |
Request Body Request Payload
| Parameter | Type | Required | Example | Description | Enum |
|---|---|---|---|---|---|
| action | string | Yes | all | Detection actions: dns (domain name resolution)/ping (ping detection)/all (all) | - |
| check_operator | string | Yes | DEFAULT | Detection operators: CHINANET (China Telecom)/UNICOM (China Unicom)/CAP (Tencent)/DEFAULT (automatic) | CHINANET UNICOM CAP DEFAULT |
3. Response Parameters
Response Body Response Payload
| Parameter | Type | Description |
|---|---|---|
| dns | objarray | List of DNS resolution results |
| ping | objarray | List of ping detection results |
Res.dns(Array) Object Payload
List of DNS resolution results
| Parameter | Type | Description |
|---|---|---|
| ip | string | Resolved IPs |
| real_operator | string | ISP corresponding to each IP |
Res.ping(Array) Object Payload
List of ping detection results
| Parameter | Type | Description |
|---|---|---|
| ip | string | IPs used for ping tests; the command executed is ping ip –c 1-w 1 -q |
| from_operator | string | ISP of the ping source, controlled by the check_operator in the request |
| package_loss | string | Ping packet loss rate: 0% indicates no packet loss, 100% indicates complete packet loss. Since only one ping packet is sent, the values can only be 0% or 100%. |
4. Notes
No special notes for this API
5. Code Example
Request Example
{
"action": "all",
"check_operator": "DEFAULT"
}
Response Example
{
"dns": [
{
"ip": "111.161.64.40",
"real_operator": "UNICOM"
},
{
"ip": "111.161.64.48",
"real_operator": "UNICOM"
}
],
"ping": [
{
"ip": "111.161.64.40",
"from_operator": "UNICOM",
"package_loss": "0%",
"time": "23.079ms"
},
{
"ip": "111.161.64.48",
"from_operator": "UNICOM",
"package_loss": "0%",
"time": "21.434ms"
}
]
}
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 | Solution |
|---|---|---|
| 40201 | invalid url | Callback URL not set |
| 40202 | invalid action | Incorrect action parameter |
| 40203 | invalid check_operator | Incorrect operator parameter |
7. Applicable Scope
| Mini Program | Official Account | Service Account | Mini Game | WeChat Shop | Alliance Agency | Influencer | Shop Supplier | Third-party Platform | Mobile App | Website App | Channels Window | Multi-platform App |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | 〇 | ✔ | ✔ | ✔ | ✔ |
- ✔:This account type can call this API。
- 〇:Third-party platforms can use component_access_token to call. For calling on behalf of Merchant, please refer to the Call Method section。