【发布时间】:2021-12-03 16:27:45
【问题描述】:
我的 twitter API 调用在 Postman 中有效,但在 AppScripts 中无效。我在两者中都设置了授权,并且使用相同的 url。
const res = UrlFetchApp.fetch(url, {
headers:{
Authorization: "Bearer ..."
},
})
console.log("res is", res);
return res;
这会返回“res is {}”
但在 Postman 中,使用相同 URL 和相同授权令牌的相同调用会返回:
{
"data": {
"id": "...",
"name": "...",
"username": "..."
}
}
【问题讨论】:
-
res是HTTPResponse对象。您需要从中获取内容。有关免费资源和更多详细信息,请参阅 tag info page。
标签: google-apps-script google-sheets postman urlfetch