var http = require('https')
var post_data ={
"button": [
{
"name": "下载APP",
"sub_button": [
{
"type": "view",
"name": "主下载地址",
"url": "https://wx.baidu.cn/app/"
},
{
"type": "view",
"name": "备用下载地址",
"url": "https://m-ios.baidu.cn/fy2w"
}
]
}
]
}
var access_token = '12312312214214214124214124124124'
var options = {
hostname: 'api.weixin.qq.com',
path: `/cgi-bin/menu/create?access_token=${access_token}`,
method: 'POST',
headers: {'Content-Type': 'application/json; charset=UTF-8'}
};
var req = http.request(options, function (res) {
res.setEncoding('utf8');
res.on('data', function (chunk) {
console.log('BODY: ' + chunk);
});
});
req.on('error', function (e) {
console.log('problem with request: ' + e.message);
});
req.write(JSON.stringify(post_data));
req.end();
你好,建议再次检查编辑的XML是否符合规范