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

相关推荐
计算机毕设指导61 分钟前
基于微信小程序的宠物走失信息管理系统【源码文末联系】
java·spring boot·mysql·微信小程序·小程序·tomcat·宠物
2501_916008892 分钟前
iOS 能耗检测的工程化方法,构建多工具协同的电量分析与性能能效体系
android·ios·小程序·https·uni-app·iphone·webview
说私域15 分钟前
基于开源链动2+1模式AI智能名片S2B2C商城小程序的线上向线下导流运营研究
人工智能·小程序·开源
小小王app小程序开发16 分钟前
任务悬赏小程序核心玩法 + 功能全解析:精准匹配与信任构建的变现逻辑
大数据·小程序
头发还在的女程序员20 分钟前
陪诊小程序成品|陪诊系统功能|陪诊系统功能(源码)
java·小程序·his系统
玩代码的老秦21 分钟前
微信小程序想要分享转发当前页面
小程序
2501_915921431 小时前
重新理解 iOS 的 Bundle Id 从创建、管理到协作的工程策略
android·ios·小程序·https·uni-app·iphone·webview
2501_915106321 小时前
当 altool 退出历史舞台,iOS 上传链路的演变与替代方案的工程实践
android·ios·小程序·https·uni-app·iphone·webview
小码哥0681 小时前
陪诊陪护小程序|上门打针|院内陪护|陪诊跑腿服务
小程序·陪诊陪护·医院陪诊问诊小程序源码·医院陪诊问诊小程序系统·医院陪诊问诊源码
00后程序员张1 小时前
Transporter 的局限与替代路径,iOS 上传流程在多平台团队中的演进
android·ios·小程序·https·uni-app·iphone·webview