小程序 获取 手机号 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. 错误的写法

相关推荐
2401_8796925129 分钟前
微信小程序照相与摄像功能实现——chooseImage 与 chooseVideo 详解
微信小程序·小程序·notepad++
李纲明2 天前
微信小程序 getSystemInfo 提示已废弃、屏幕高度算错胶囊还对不齐?getWindowInfo 和 getDeviceInfo 怎么接才稳
javascript·微信小程序·小程序·小程序开发·devdiy
dreams_dream2 天前
微信小程序-使用npm包
微信小程序·小程序·npm
caoliaoerweima2 天前
草料二维码小程序上线活码编辑器:手机上也能编辑活码了
智能手机·小程序·编辑器·草料二维码
dreams_dream4 天前
微信小程序:页面事件-上拉触底
微信小程序·小程序
wafrdggh5 天前
2026电商快递批量查询怎么用?固乔助手模板设置评测
大数据·数据库·小程序
wafrdggh6 天前
2026 商城小程序平台哪个价格合理?把跨境附加成本这个坑算透
大数据·小程序
恩创软件开发8 天前
自助KTV系统管理员续单功能
经验分享·小程序
AI源码10 天前
在线考试小程序
小程序·notepad++
2501_9160088910 天前
iPhone 设备信息查看,用 KeyMob 看型号、序列号、电池健康和 UDID
android·ios·小程序·https·uni-app·iphone·webview