使用介面建立自訂選單後,開發者也可使用介面查詢自訂選單的結構。另外請注意,在設定了個人化選單後,使用本自訂選單查詢介面可以取得預設選單和全部個人化選單資訊。
請求說明
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為個人化選單列表。欄位說明請參閱個人化選單介面頁的說明。
【相關推薦】
1. 特別推薦#:「php程式設計師工具箱」V0.1版本下載
2. 微信公眾號平台原始碼下載
3. 阿狸子訂單系統原始碼下載
#以上是微信開發之選單查詢接口的詳細內容。更多資訊請關注PHP中文網其他相關文章!