微信公眾平臺(tái) 自定義菜單查詢接口

2018-07-27 09:38 更新

自定義菜單查詢接口



使用接口創(chuàng)建自定義菜單后,開發(fā)者還可使用接口查詢自定義菜單的結(jié)構(gòu)。另外請(qǐng)注意,在設(shè)置了個(gè)性化菜單后,使用本自定義菜單查詢接口可以獲取默認(rèn)菜單和全部個(gè)性化菜單信息。

請(qǐng)求說明

http請(qǐng)求方式:GET
https://api.weixin.qq.com/cgi-bin/menu/get?access_token=ACCESS_TOKEN

返回說明(無個(gè)性化菜單時(shí))

對(duì)應(yīng)創(chuàng)建接口,正確的Json返回結(jié)果:
{
    "menu": {
        "button": [
            {
                "type": "click", 
                "name": "今日歌曲", 
                "key": "V1001_TODAY_MUSIC", 
                "sub_button": [ ]
            }, 
            {
                "type": "click", 
                "name": "歌手簡(jiǎn)介", 
                "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": [ ]
                    }
                ]
            }
        ]
    }
}

返回說明(有個(gè)性化菜單時(shí))

{
    "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": "中國(guó)", 
                "province": "廣東", 
                "city": "廣州", 
                "client_platform_type": 2
            }, 
            "menuid": 208396993
        }
    ]

}

注:menu為默認(rèn)菜單,conditionalmenu為個(gè)性化菜單列表。字段說明請(qǐng)見個(gè)性化菜單接口頁(yè)的說明。

使用網(wǎng)頁(yè)調(diào)試工具調(diào)試該接口

微信網(wǎng)頁(yè)調(diào)試工具

以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)