I'm trying to fetch a URL using optional advanced parameters in GAS:
function myFunction() {
var options = {};
options = {
headers: {
Authorization: 'Bearer ?????',
'Content-Type': 'application/json',
},
};
UrlFetchApp.fetch(<url>, options);
}
I always get:
Request failed for returned code 406 (line 52, file "Project").
HTTPResponse:
SyntaxError: Empty JSON string
I did the same fetching in Excel Power Query:
let
Source = Json.Document(Web.Contents(<URL>, [Headers=[Authorization="Bearer
?????????????", ContentType="application/json"]])),
And it works, it works also using Postman...
What's the problem with GAS? Please help me! Thanks in advance to everybody.
Andrea
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…