1. When requesting the WeChat Mini Program API: get unlimited mini program code, an error occurred: errcode: 47001, errmsg: data format error rid. See Figure 1.

Plaintext
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. I adjusted the Content-Type of the request parameters, which resolved the issue. Then another error occurred: errcode: 41030, errmsg: invalid page rid. See Figure 2.

Plaintext
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. I set the request parameter “check_path” to false, which resolved the issue. Then another error occurred: Unrecognized format ”. See Figure 3.

Plaintext
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. I changed the response format to raw-urlencoded, which resolved the issue.
PHP
$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;
