草庐IT

微信小程序获取手机号47001 data format error hint的完美解答(restTemplate发送post请求)

发现问题这几天正在搞微信小程序获取手机号功能开发,发现发送post请求接口时候,接口返回如下错误:{"errcode":47001,"errmsg":"dataformaterrorhint:[******]rid:******"}post请求的url为:https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token={access_token}现放上正确代码:publicWxPhoneDTOgetPhoneNumber(StringaccessToken,Stringcode){StringphoneUrl="ht

微信小程序获取手机号码 phonenumber.getPhoneNumber 提示47001错误

微信小程序获取手机号码phonenumber.getPhoneNumber提示47001错误微信小程序获取客户端手机号码,踩的坑。如下提示:{"errcode":47001,"errmsg":"dataformaterrorhint:[6kMDxSDNRa-hAwqia]rid:6308d1b5-69935bc9-1d99d19f"}经过测试,文档说的是body类型实际却是json类型正确代码如下:publicstaticStringgetWxPhone(Stringcode,Stringappid,StringappSecret){Stringurl="https://api.weixin.

微信小程序通过code获取手机号,提示:{errcode: 47001, errmsg: “data format error hint: [xxxxxx] rid: xxxxxx“}的解决办法

微信小程序官方文档里,需要用POST提交到:https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=ACCESS_TOKEN请求参数是access_token和code 看文档后,会误认为要提交两个参数access_token和code,实际上只需要提交code就行。提交的地址是:https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=xxxx提交code后,发现提示错误{errcode:47001,errmsg:"data

微信服务端接口返回信息: “errcode“ : 44002/47001解决方式

举例接口:POSThttps://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=ACCESS_TOKEN接口文档:微信官方文档·小程序/手机号/getPhoneNumber错误44002:{"errcode":44002,"errmsg":"emptypostdatahint:[fEmAsDOre-5_d8LA]rid:62183ab5-2b35a499-4ccae8ac"}说明:44002表示POST请求体中没有数据,也就是没有传参解决:将参数code放入请求体中(body)进行传参,而不是在URL中例:POST