脚本令牌_js调用接口更新

// API配置

const token = '你的token';

const apiUrl = `你的webhook`;

const xhr = new XMLHttpRequest();

xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {

if (this.readyState === this.DONE) {

console.log(this.responseText);

}

});

xhr.open("POST", apiUrl);

xhr.setRequestHeader("Content-Type", "application/json");

// 移除不被CORS允许的AirScript-Token请求头

// 将token放在请求体中

const dataWithToken = JSON.stringify({

"Context": {

"argv": { "value": "老粮仓" }

},

"token": token

});

xhr.send(dataWithToken);

湖南省
浏览 106
收藏
2
分享
2 +1
2
+1
全部评论 2
 
fox
啥时候更的啊,以后都这么请求,还是没正式更新呢
· 黑龙江省
回复
唯心
意思是你按照文档的可以用, JS 的请求示例 我用他的示例不能用
· 湖南省
回复