When requesting the WeChat Mini Program interface: obtaining unrestricted applet code, troubleshooting and analysis of some problems (Errcode: 41030, errmsg: Invalid Page Rid, Errcode: 47001, errmsg: data Format Error Rid, Unrecognized format)

调整请求参数的 "check_path":false ,得以解决。然后报另外一个错误:Unrecognized format ''
1. When requesting the WeChat Mini Program interface: obtaining unrestricted applet code, an error is reported: errcode: 47001, errmsg: data format error Rid. as shown in Figure 1
在请求微信小程序接口:获取不限制的小程序码 时,报错:errcode:47001,errmsg:data format error rid
Figure 1


Post https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token={token}
content-type: application/x-www-form-urlencoded; charset=utf-8

scene=1825203750690640&page=pages%2findex%2findex


2. Adjust the content-type of the request parameter and solve it. Then another error is reported: errcode: 41030, errmsg: invalid page Rid. as shown in Figure 2
调整请求参数的 Content-Type ,得以解决。然后报另外一个错误:errcode:41030,errmsg:invalid page rid
Figure 2


Post https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token={token}
content-type: application/json; charset=utf-8

{"scene":"1825203750690640","page":"pages/index/index","width":null}


3. Adjust the “check_path”:false of the request parameter to solve it. Then report another error: unrecognized format. as shown in Figure 3
调整请求参数的 "check_path":false ,得以解决。然后报另外一个错误:Unrecognized format ''
Figure 3


Post https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token={token}
content-type: application/json; charset=utf-8

{"scene":"1825203750690640","page":"pages/index/index","width":null,"check_path":false}


4. Adjust the response format to raw-urlencoded, which can be solved


        $response = $this->httpClient->createRequest()
            ->setMethod('POST')
            ->setUrl('wxa/getwxacodeunlimit?access_token=' . $accessToken)
            ->setFormat(Client::FORMAT_JSON)
            ->setData([
                'scene' => $scene,
                'page' => $page,
                'width' => $width,
                'check_path' => false,
                'env_version' => 'trial'
            ])
            ->send();

        // 设置响应格式为 raw-urlencoded(二进制数据)
        $response->format = Client::FORMAT_RAW_URLENCODED;


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.