问题描述
我正在尝试使用 Apps 脚本自动将调查数据从 Zenloop(调查工具)提取到 Google 表格中。执行该函数时,出现如下错误:
错误:
异常:https://api.zenloop.com
的请求失败返回代码 401。截断的服务器响应:{"error":{"code":"UNAUTHORIZED","status":401,"title":"无效或过期的令牌."}}(使用 muteHttpExceptions 选项检查完整响应)
脚本:
function myFunction() {
const options = {
method: 'GET',headers: {
Authorization: 'XXXXXXXXXXX','Content-Type': 'application/json'
}
};
UrlFetchApp.fetch('https://api.zenloop.com/v1/survey_groups/XXXXXXXXXXX/answers?date_shortcut=all_time&order_type=desc&page=1',options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));
}
我已将 API 密钥和调查 ID 删除。我是 Apps Script/Javascript 的新手,因此非常感谢这里的任何人。 API 密钥或调查 ID 没有问题,我已经三重检查了。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)