W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗值獎勵
本接口應(yīng)在服務(wù)器端調(diào)用,詳細說明參見服務(wù)端API。
本接口支持云調(diào)用。需開發(fā)者工具版本 >= 1.02.1904090(最新穩(wěn)定版下載)
wx-server-sdk >= 0.4.0
獲取小程序賬號的類目
調(diào)用方式:
GET https://api.weixin.qq.com/wxaapi/newtmpl/getcategory?access_token=ACCESS_TOKEN
屬性 | 類型 | 默認值 | 必填 | 說明 |
---|---|---|---|---|
access_token | string | 是 | 接口調(diào)用憑證 |
屬性 | 類型 | 說明 |
---|---|---|
errcode | number | 錯誤碼 |
errmsg | string | 錯誤信息 |
data | Array.<Object> | 類目列表 |
data 的結(jié)構(gòu)
屬性 | 類型 | 說明 |
---|---|---|
id | number | 類目id,查詢公共庫模版時需要 |
name | string | 類目的中文名 |
{
"errcode": 0,
"errmsg": "ok",
"data": [
{
"id": 616,
"name": "公交"
}
]
}
云調(diào)用是小程序·云開發(fā)提供的在云函數(shù)中調(diào)用微信開放接口的能力,需要在云函數(shù)中通過 wx-server-sdk 使用。
openapi.subscribeMessage.getCategory
需在 config.json 中配置 subscribeMessage.getCategory API 的權(quán)限,詳情
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
}
}
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: