暴雪刚刚关闭了他们的旧API,并做了一个改变,所以你需要一个apikey。我将URL更改为新的api,并添加了API密钥。我知道该网址是有效的。JSON.parse返回undefined对象
var toonJSON = UrlFetchApp.fetch("eu.api.battle.net/wow/character/"+toonRealm+"/"+toonName+"?fields=items,statistics,progression,talents,audit&apikey="+apiKey, {muteHttpExceptions: true})
var toon = JSON.parse(toonJSON.getContentText())
JSON.pase只返回一个空的对象
return toon.toSorce() // retuned ({})
我用了很多时间来看看我是否能找到问题所在。已经空了。认为它与“响应标题”有关。
性反应的标题:http://pastebin.com/t30giRK1(我把他们从dev.battle.net(暴风雪API网站) JSON:http://pastebin.com/CPam4syG
你有什么想法如何得到UrlFetchApp.fetch工作?我还得出结论,这是一个有效的JSON。 –
对不起,我对那个图书馆并不熟悉 – Napoleon