【发布时间】:2020-01-15 08:03:02
【问题描述】:
我正在尝试使用 google app 脚本通过外部 API 获取数据,但我不断收到 Request failed for https://api.10000ft.com returned code 404。服务器响应被截断:
在调试时,它告诉我响应未定义。我可能做错了什么?
代码如下:
function fetchSheet() {
var response = UrlFetchApp.fetch('https://api.10000ft.com/api/v1/users//time_entries?from=2020-01-06&to=2020-01-14&auth=token');
Logger.log(response.getContentText());
}
【问题讨论】:
-
api.10000ft.com是否允许跨源请求? -
嗨 – Jaromanda X,是的
-
截断的服务器响应是什么?
-
//中的users//time是错字吗? -
TheMaster 这里是响应消息 Request failed for api.10000ft.com 返回代码 404。截断的服务器响应:{"message":"not found"}(使用 muteHttpExceptions 选项检查完整响应) (第 2 行,文件“GetTimehseets”)
标签: javascript rest api google-apps-script get