0

trying retrieve blog but return error:

[13-05-25 07:45:42:500 PDT] Exception: Request failed for
https://www.googleapis.com/blogger/v3/users/self/blogs returned code
404. Server response: <!DOCTYPE html> <html lang=en>   <meta charset=utf-8>   <meta name=viewport content="initial-scale=1,
minimum-scale=1, width=device-width">   <title>Error 404 (Not
Found)!!1</title>   <style>
    *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7%
auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* >
body{background:url(//www.google.com/images/errors/robot.png) 100% 5px
no-repeat;padding-right:205px}p{margin:11px 0
22px;overflow:hidden}ins{color:#777;text-decoration:none}a
img{border:0}@media screen and
(max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}
</style>   <a href=//www.google.com/><img
src=//www.google.com/images/errors/logo_sm.gif alt=Google></a>  
<p><b>404.</b> <ins>That’s an error.</ins>   <p>The requested URL
<code>/blogger/v3/users/self/blogs</code> was not found on this
server.  <ins>That’s all we know.</ins>

here my code :

function retrieveBlog(){
  var access_token ="my acces token";
  var options =
      {
        "headers" : { " Authorization " :  access_token}
      };

  try {

    var result = UrlFetchApp.fetch("https://www.googleapis.com/blogger/v3/users/self/blogs",options);

    Logger.log(result);

  } catch (e) {
    Logger.log(e);
  }
}

can you tell me what iam wrong????

4

1 回答 1

0

刚刚做了一个快速测试,发现你在Authorization标题周围有一个额外的空间。

试试这条线 -

"headers" : { "Authorization" : access_token}

对我来说工作得很好。

于 2013-05-25T23:13:01.107 回答