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

相关推荐
盛夏绽放8 小时前
微信小程序地图map全方位解析
微信小程序·小程序
初尘屿风11 小时前
基于微信小程序的电影院订票选座系统的设计与实现,SSM+Vue+毕业论文+开题报告+任务书+指导搭建视频
vue.js·微信小程序·小程序
paterWang12 小时前
基于SpringBoot的驾校报名小程序系统设计与实现(源码+文档)
spring boot·后端·小程序
EasyNVR13 小时前
EasyRTC:全平台支持与自研算法驱动的智能音视频通讯解决方案
运维·服务器·小程序·音视频·webrtc·p2p·智能硬件
韩召华19 小时前
微信小程序(uni)+蓝牙连接+Xprint打印机实现打印功能
微信小程序·小程序·notepad++
韩召华19 小时前
微信小程序实现拉卡拉支付
微信小程序·小程序
嘻哈∠※1 天前
基于SpringBoot+vue粮油商城小程序系统
vue.js·spring boot·小程序
luckyext1 天前
HBuilderX中,VUE生成随机数字,vue调用随机数函数
前端·javascript·vue.js·微信小程序·小程序
毕业设计-011 天前
0081.基于springboot+uni-app的垃圾分类小程序+论文
spring boot·小程序·uni-app
狂团商城小师妹1 天前
挪车小程序挪车二维码php+uniapp
微信小程序·小程序·uni-app·微信公众平台