博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
自定义菜单查询接口
阅读量:7121 次
发布时间:2019-06-28

本文共 6143 字,大约阅读时间需要 20 分钟。

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

请求说明

http请求方式:GEThttps://api.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": "http://www.soso.com/",                         "sub_button": [ ]                    },                     {                        "type": "view",                         "name": "视频",                         "url": "http://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为个性化菜单列表。字段说明请见个性化菜单接口页的说明。

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

请求说明

http请求方式:GEThttps://api.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": "http://www.soso.com/",                         "sub_button": [ ]                    },                     {                        "type": "view",                         "name": "视频",                         "url": "http://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为个性化菜单列表。字段说明请见个性化菜单接口页的说明。

本文转自  陈小龙哈   51CTO博客,原文链接:http://blog.51cto.com/chenxiaolong/1782635

转载地址:http://wkoel.baihongyu.com/

你可能感兴趣的文章
爬虫抓包
查看>>
软件测试工程师的技能树
查看>>
聊聊架构
查看>>
小米4.0系统如何不Root激活xposed框架的方法
查看>>
Android跨界面共享数据——LiveData应用
查看>>
华为余承东:自产AI芯片 旗舰机比苹果、三星强
查看>>
微软Azure SQL数据仓储供优惠价格购买预留容量
查看>>
Java8ConcurrentHashMap
查看>>
数据分析Power BI数据可视化教程(三)——如何创建矩阵和表以及散点图
查看>>
NoSQL最新现状和趋势:云NoSQL数据库将成重要增长引擎
查看>>
Vue组件传值
查看>>
Pentaho Report Designer
查看>>
我与Node.js重新认识的第2周 - Node.js 底层
查看>>
react-native搭建用例(非CRNA)
查看>>
HTTP协议
查看>>
github简单使用
查看>>
Python提取网站数据笔记
查看>>
隐私政策
查看>>
appium自动化环境搭建(python语言开发)
查看>>
我的前端知识体系-css(盒模型篇上)
查看>>