To help developers troubleshoot callback connection failures, we provide this API for network detection. It can perform domain name resolution on the developer URL, and then ping all IPs to get the packet loss rate and the time spent.

HTTP Post request:
https://api.weixin.qq.com/cgi-bin/callback/check?access_token=ACCESS_TOKEN

Request in JSON format:

{
    "action": "all", 
    "check_operator": "DEFAULT"
}

Parameters

Parameter Required Description
action Yes The detection action to be executed. Supported values include: dns (performs domain name resolution), ping (performs ping detection), and all (performs both dns and ping).
check_operator Yes Specifies the operator from which the detection starts. Supported values include: CHINANET (Telecom egress), UNICOM (Unicom egress), CAP (Tencent's self-deployed egress), and DEFAULT (selects operator based on the IP)

Response in JSON format

{
    "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"
        }
    ]
}

Parameters

Parameter Description
dns DNS result list
dns.ip Resolved IP
dns.real_operator Operator of the IP
ping The ping result list
ping.ip The IP to ping. The command is ping ip –c 1-w 1 -q.
ping.from_operator The operator from which the ping starts, which is controlled by the check_operator in the request.
ping.package_loss The packet loss rate of the ping. 0% means no packet loss, and 100% means all packets are lost. Since only one ping packet is sent, the value can only be 0% or 100%.
ping.time The time spent for the ping. The average time spent for the ping results is used.

Error codes (only the error codes added in this API are listed)

Error Code Description
40202 Incorrect action
40203 Incorrect check_operator
40201 Incorrect URL. This is usually because the developer does not set a callback URL.