【问题标题】:Try to access sites data using google script尝试使用谷歌脚本访问网站数据
【发布时间】:2012-11-23 10:22:16
【问题描述】:

我试图通过谷歌脚本和 Oauth 操场获取相同的 URL .....在操场上它工作正常并给出状态 200 OK..但是使用谷歌脚本,它给出了无效的参数错误......给我一些建议

URL='https://sites.google.com/feeds/content/domainname/siteName/-/template|-template '

代码:

 var base = 'https://sites.google.com/feeds/';
     var fetchArgs = googleOAuth_('sites', base);
     fetchArgs.method = 'GET';

 var url=https://sites.google.com/feeds/content/domainname/siteName/-/template|-template'
       var resultOfSiteWebPages=UrlFetchApp.fetch(url,fetchArgs)

在 UrlFetch 中给出错误

【问题讨论】:

    标签: google-apps-script google-sites


    【解决方案1】:

    这很可能是编码问题。 oAuth 游乐场可能会为您编码 url 而UrlFetch 不会。试试这个:

    var resultOfSiteWebPages = UrlFetchApp.fetch(encodeURI(url), fetchArgs);
    

    【讨论】:

    • @Rishi 不客气。既然您是新来的……当您觉得答案不错时,应该将答案标记为已接受。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-09
    • 2021-10-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多