调用创建自定义菜单接口报错,求大神们教

theNinethDay 2016-03-21 12:22:58
调用创建自定义菜单接口https://api.weixin.qq.com/cgi-bin/menu/create?access_token=ACCESS_TOKEN,报按钮url长度太长的错误,

查了下文档,说1024个字节是上限,我迷茫了,因为我要加网页授权啊,所以url长度必然很长的

这是我根据接口发过去的JSON:
{
"button":[
{
"type":"view",
"name":"联系我们",
"url":"https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx10d22fe60c7e2ca2&redirect_uri=http%3A%2F%2Fwww.XXXXXXXX.com%3A8088%2FweixinPage%2FshowContactDoctor.do&response_type=code&scope=snsapi_base#wechat_redirect"
}
]
}

报错是这个:
{"errcode":40020,"errmsg":"invalid button url size hint: [kW_iMA0385vr20]"}


微信开发者文档原话是这样的:
2、view:跳转URL用户点击view类型按钮后,微信客户端将会打开开发者在按钮中填写的网页URL,可与网页授权获取用户基本信息接口结合,获得用户基本信息。

这说明是可以与网页授权合用的,在线等大神帮忙解决。。。
...全文
587 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
theNinethDay 2016-03-21
  • 打赏
  • 举报
回复
引用 3 楼 u011738153 的回复:
晕,又少了边中括号,这下对了: { "button": [ { "type": "view", "name": "联系我们", "url": "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx10d22fe60c7e2ca2&redirect_uri=http%3A%2F%2Fwww.XXXXXXXX.com%3A8088%2FweixinPage%2FshowContactDoctor.do&response_type=code&scope=snsapi_base#wechat_redirect", "sub_button": [ ] } ] }
还是一样啊,报那个40020错误,而且官方文档也有没有写那个sub_button的
Bob_張 2016-03-21
  • 打赏
  • 举报
回复
晕,又少了边中括号,这下对了: { "button": [ { "type": "view", "name": "联系我们", "url": "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx10d22fe60c7e2ca2&redirect_uri=http%3A%2F%2Fwww.XXXXXXXX.com%3A8088%2FweixinPage%2FshowContactDoctor.do&response_type=code&scope=snsapi_base#wechat_redirect", "sub_button": [ ] } ] }
Bob_張 2016-03-21
  • 打赏
  • 举报
回复
少了个JSON节点,用下面这个试试 ,上面的我少敲了个括号。。。 { "button": [ { "type": "view", "name": "联系我们", "url": "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx10d22fe60c7e2ca2&redirect_uri=http%3A%2F%2Fwww.XXXXXXXX.com%3A8088%2FweixinPage%2FshowContactDoctor.do&response_type=code&scope=snsapi_base#wechat_redirect", "sub_button": [ ] } }
Bob_張 2016-03-21
  • 打赏
  • 举报
回复
少了个JSON节点,用下面这个试试 { "button": [ { "type": "view", "name": "联系我们", "url": "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx10d22fe60c7e2ca2&redirect_uri=http%3A%2F%2Fwww.XXXXXXXX.com%3A8088%2FweixinPage%2FshowContactDoctor.do&response_type=code&scope=snsapi_base#wechat_redirect", "sub_button": [ ] },
theNinethDay 2016-03-21
  • 打赏
  • 举报
回复
我自己顶。。。。。。。。。

3,143

社区成员

发帖
与我相关
我的任务
社区描述
微信开发即微信公众平台开发,将企业信息、服务、活动等内容通过微信网页的方式进行表现,通过二次开发可以将公众账号由一个媒体型营销工具转化成提供服务的产品。
社区管理员
  • 微信开发
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧