【发布时间】:2019-07-12 08:50:06
【问题描述】:
我正在尝试从 URL 获取 JSON 数据并将数据插入 Google 表格的表格中。问题是当我尝试获取数据时,这会响应我该错误:
https://ssl-vp.com/rest/v1/Campaigns/1236223656534991/Recipients?by=ExternalId&page=1&itemsPerPage=500 的返回码 401 的请求出错。截断的服务器响应:未经授权无法获取活动联系人(使用 muteHttpExceptions 选项检查整个响应)(第 15 行,文件“Código”)
我尝试在 URL 中插入 API KEY,但响应是相同的错误
function myFunction(){
var url = "https://ssl-vp.com/rest/v1/Campaigns/1236223656534991/Recipients?by=ExternalId&page=1&itemsPerPage=500";
var apiKey = "xxxxxxxxxxxxxxxxxxxxx";
var header={
"headers":{
"X-API-KEY":apiKey
}
};
var response = UrlFetchApp.fetch(url,header);
Logger.log(response.getContentText());
}
【问题讨论】:
标签: google-apps-script google-sheets api-key