温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

微信开发之菜单查询接口的使用示例

发布时间:2021-01-21 15:05:31 来源:亿速云 阅读:164 作者:小新 栏目:移动开发

小编给大家分享一下微信开发之菜单查询接口的使用示例,希望大家阅读完这篇文章之后都有所收获,下面让我们一起去探讨吧!

使用接口创建自定义菜单后,开发者还可使用接口查询自定义菜单的结构。另外请注意,在设置了个性化菜单后,使用本自定义菜单查询接口可以获取默认菜单和全部个性化菜单信息。

请求说明

http请求方式:GETapi.weixin.qq.com/cgi-bin/menu/get?access_token=ACCESS_TOKEN

返回说明(无个性化菜单时)

对应创建接口,正确的Json返回结果:
{"menu":{"button":[{"type":"click","name":"今日歌曲","key":"V1001_TODAY_MUSIC","sub_button":[]},{"type":"click","name":"歌手简介","key":"V1001_TODAY_SINGER","sub_button":[]},{"name":"菜单","sub_button":[{"type":"view","name":"搜索","url":"www.soso.com/","sub_button":[]},{"type":"view","name":"视频","url":"v.qq.com/","sub_button":[]},{"type":"click","name":"赞一下我们","key":"V1001_GOOD","sub_button":[]}]}]}}

返回说明(有个性化菜单时)

{
    "menu": {
        "button": [
            {
                "type": "click",
                 "name": "今日歌曲", 
                "key": "V1001_TODAY_MUSIC",
                 "sub_button": [ ]
            }
        ],
         "menuid": 208396938
    },
    "conditionalmenu": [
        {
            "button": [
                {
                    "type": "click",
                    "name": "今日歌曲",
                    "key": "V1001_TODAY_MUSIC",
                     "sub_button": [ ]
                },
                 {
                    "name": "菜单",
                    "sub_button": [
                        {
                            "type": "view",
                            "name": "搜索",
                            "url": "http://www.soso.com/",
                            "sub_button": [ ]
                        },
                         {
                            "type": "view",
                            "name": "视频",
                             "url": "http://v.qq.com/",
                             "sub_button": [ ]
                        },
                         {
                            "type": "click",
                            "name": "赞一下我们",
                            "key": "V1001_GOOD",
                            "sub_button": [ ]
                        }
                    ]                }
            ],
             "matchrule": {
                "group_id": 2,
                "sex": 1,
                "country": "中国",
                "province": "广东",
                "city": "广州",
                "client_platform_type": 2
           },
             "menuid": 208396993
        }
    ]
}

注:menu为默认菜单,conditionalmenu为个性化菜单列表。字段说明请见个性化菜单接口页的说明。

看完了这篇文章,相信你对“微信开发之菜单查询接口的使用示例”有了一定的了解,如果想了解更多相关知识,欢迎关注亿速云行业资讯频道,感谢各位的阅读!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI