新聞中心
這里有您想知道的互聯網營銷解決方案
創(chuàng)新互聯小程序教程:微信小程序訂閱消息·getCategory
subscribeMessage.getCategory
本接口應在服務器端調用,詳細說明參見 服務端API。
創(chuàng)新互聯專注于烏魯木齊企業(yè)網站建設,響應式網站,電子商務商城網站建設。烏魯木齊網站建設公司,為烏魯木齊等地區(qū)提供建站服務。全流程按需網站開發(fā),專業(yè)設計,全程項目跟蹤,創(chuàng)新互聯專業(yè)和態(tài)度為您提供的服務
本接口支持 云調用。需開發(fā)者工具版本 >= 1.02.1904090(最新 穩(wěn)定版下載)
wx-server-sdk >= 0.4.0
獲取小程序賬號的類目
調用方式:
- HTTPS 調用
- 云調用
HTTPS 調用
請求地址
GET https://api.weixin.qq.com/wxaapi/newtmpl/getcategory?access_token=ACCESS_TOKEN
請求參數
| 屬性 | 類型 | 默認值 | 必填 | 說明 |
|---|---|---|---|---|
| access_token | string | 是 | 接口調用憑證 |
返回的 JSON 數據包
| 屬性 | 類型 | 說明 |
|---|---|---|
| errcode | number | 錯誤碼 |
| errmsg | string | 錯誤信息 |
| data | Array. | 類目列表 |
data 的結構
| 屬性 | 類型 | 說明 |
|---|---|---|
| id | number | 類目id,查詢公共庫模版時需要 |
| name | string | 類目的中文名 |
響應示例
{
"errcode": 0,
"errmsg": "ok",
"data": [
{
"id": 616,
"name": "公交"
}
]
}
云調用
云調用是小程序·云開發(fā)提供的在云函數中調用微信開放接口的能力,需要在云函數中通過 wx-server-sdk 使用。
接口方法
openapi.subscribeMessage.getCategory
需在 config.json 中配置 subscribeMessage.getCategory API 的權限,詳情
請求示例
const cloud = require('wx-server-sdk')
cloud.init()
exports.main = async (event, context) => {
try {
const result = await cloud.openapi.subscribeMessage.getCategory({})
return result
} catch (err) {
return err
}
}
響應示例
const cloud = require('wx-server-sdk')
cloud.init()
exports.main = async (event, context) => {
try {
const result = await cloud.openapi.subscribeMessage.getCategory({
errcode: 0,
errmsg: 'ok',
data: [
{
id: 616,
name: '公交'
}
]
})
return result
} catch (err) {
return err
}
}
文章名稱:創(chuàng)新互聯小程序教程:微信小程序訂閱消息·getCategory
鏈接分享:http://m.fisionsoft.com.cn/article/dhehjgs.html


咨詢
建站咨詢

