问题陈述:无法使用clubhouse.io api检索数据在Google表格中>脚本编辑器
每个developers.google.com: 某些HTTP方法(例如GET)不接受有效负载。但是,clubhouse v3 api期望GET请求中的正文/有效载荷]
这里是方法:
function getClubhouseStories() {
try{
var myHeaders = {"Content-Type": "application/json"};
var requestOptions = {
method: 'GET',
headers: myHeaders,
body: JSON.stringify({"query":"lable\:my label"}),
redirect: 'follow',
query: {"token": "XXXXXXXXUUIDXXXXX"},
muteHttpExceptions: true
};
var response = UrlFetchApp.fetch("https://api.clubhouse.io/api/v3/search/stories", requestOptions);
}
catch(error) {
console.error(error);
}
var responseCode = response.getResponseCode();
var responseContent = response.getContentText();
Logger.log(responseCode);
Logger.log(responseContent);
}
返回:
responseCode >> 401
responseContent >> "{"message":"Sorry, the organization context for this request is missing. If you have any questions please contact us at [email protected].","tag":"organization2_missing"}"
相同的请求通过postman
或bash
可以完美工作,不需要正文的请求也可以通过UrlFetchApp.fetch
进行工作>
标签:
#clubhouse-api #google-apps-scripts #postman
问题陈述:无法使用Google表格中的clubhouse.io api检索数据>脚本编辑器每个developers.google.com:某些HTTP方法(例如GET)不接受有效载荷。 ...
您可以将token
和query
参数作为URL的一部分。