没有不值得去解决的问题,也没有不值得去学习的技术!

在调用微信公众号预览接口【订阅号与服务号认证后均可用】时,报错:errcode:40132,errmsg:invalid username rid: 60dac95d-5c42d192-50f09436 的排查分析

查看返回码说明,原因为:微信号不合法。

1、查看开发文档,预览接口【订阅号与服务号认证后均可用】。如图1

查看开发文档,预览接口【订阅号与服务号认证后均可用】
图1

2、实际调用后,响应报错:errcode:40132,errmsg:invalid username rid: 60dac95d-5c42d192-50f09436。

Plaintext

Array
(
    [code] => 200
    [status] => OK
    [responseline] => HTTP/1.0 200 OK
    [headers] => Array
        (
            [Connection] => close
            [Content-Type] => application/json; encoding=utf-8
            [Date] => Tue, 29 Jun 2021 07:18:54 GMT
            [Content-Length] => 77
        )

    [content] => {"errcode":40132,"errmsg":"invalid username rid: 60dac95d-5c42d192-50f09436"}
    [meta] => HTTP/1.0 200 OK
Connection: close
Content-Type: application/json; encoding=utf-8
Date: Tue, 29 Jun 2021 07:18:54 GMT
Content-Length: 77

{"errcode":40132,"errmsg":"invalid username rid: 60dac95d-5c42d192-50f09436"}
)

3、查看返回码说明,原因为:微信号不合法。如图2

查看返回码说明,原因为:微信号不合法。
图2

4、查看请求参数,touser=13980000000,即手机号。如图3

查看请求参数,touser=13980000000,即手机号。
图3

5、修改请求参数,touser=shuijingsewwwwqnwq66tt,即微信号。响应成功。如图4

修改请求参数,touser=shuijingsewwwwqnwq66tt,即微信号。响应成功。
图4
Plaintext

Array
(
    [code] => 200
    [status] => OK
    [responseline] => HTTP/1.0 200 OK
    [headers] => Array
        (
            [Connection] => close
            [Content-Type] => application/json; encoding=utf-8
            [Date] => Tue, 29 Jun 2021 07:31:01 GMT
            [Content-Length] => 40
        )

    [content] => {"errcode":0,"errmsg":"preview success"}
    [meta] => HTTP/1.0 200 OK
Connection: close
Content-Type: application/json; encoding=utf-8
Date: Tue, 29 Jun 2021 07:31:01 GMT
Content-Length: 40

{"errcode":0,"errmsg":"preview success"}
)

关于作者 · 持续学习与技术实践

我是一名拥有 15 年以上开发经验的技术从业者,自 2013 年起持续运营个人技术博客,记录工作与个人项目中遇到的真实问题,以及解决问题过程中的探索、实践和思考。

除了技术写作,我也在持续开发和维护自己的独立项目,探索新技术和新工具在实际场景中的应用。我始终相信,没有不值得去解决的问题,也没有不值得去学习的技术。

如果这篇文章对你有所帮助,欢迎浏览博客中的其他文章,也欢迎交流技术经验与想法。

关于我  ·  GitHub  ·  邮件联系