小程序 获取 手机号 47001 data format error hint

0.场景

后端获取小程序用户手机号 ,api文档

https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/user-info/phone-number/getPhoneNumber.html

使用hutool工具作为http client

1. 正确的写法

正确示例

java 复制代码
   String tencentUrl = StringUtils.format("https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token={}",access_token);
        HashMap<String, Object> paramMap = new HashMap<>(1);
        paramMap.put("code",jsonRes.getStr("code"));
        String jsonStr =JsonUtils.toJsonString(paramMap);
        HttpResponse httpResponse = HttpRequest.post(tencentUrl)
            .body(jsonStr).execute();

2. 错误的写法

相关推荐
游戏开发爱好者81 天前
iOS应用性能监控:Pre-Main与Main函数耗时分析及Time Profiler使用教程
android·ios·小程序·https·uni-app·iphone·webview
StarChainTech1 天前
先享后付,正在悄悄改变电商的“信任游戏”
大数据·人工智能·游戏·微信小程序·小程序·软件需求
小羊Yveesss1 天前
门店小程序外卖配送搭建实战:配送对接、运费策略与多门店调度方案
小程序·apache
tianxiaxue11 天前
企业微信与小程序互联互通
小程序·企业微信
微擎应用2 天前
全渠道批发订货商城小程序管理系统
大数据·小程序
杰建云1672 天前
多商家入驻小程序平台怎么做
人工智能·小程序
Giggle12182 天前
开发上门维修(家政)小程序系统的核心功能和便捷方案
大数据·小程序
2501_916008892 天前
ChatGPT前端开发学习指南:Visual Studio Code与谷歌浏览器安装配置详解
ide·vscode·ios·小程序·uni-app·编辑器·iphone
杰建云1672 天前
门店小程序怎么运营
大数据·小程序
万岳科技程序员小金2 天前
2026互联网医院系统源码开发方案:APP+小程序+HIS一体化
小程序·互联网医院系统源码·医院app开发·医院软件开发·医疗陪诊小程序·医院平台开发·医院平台搭建