2011-02-02 134 views
0

我在嘗試使用Google提供的協議API更新Blogger帖子。我創建了新的帖子,工作很好,但更新正在導致我的問題。我有以下代碼(Javascript):Blogger API返回400請求編輯URI

 postRequest = new Ajax.Request("http://www.blogger.com/feeds/" + activeBlogID + "/posts/default/" + activePostID, 
     { 
      method: 'put', 
      contentType: 'application/atom+xml', 
      postBody: postXML, 
      requestHeaders: 
      { 
       Authorization: 'GoogleLogin auth=' + authCode 
      }, 
      onSuccess: this.postRequestSuccess.bind(this), 
      onFailure: this.postRequestFailure.bind(this) 
     }); 

但是每次這都會返回一個400 Bad Request URI。據我所知,URI是正確的(它與'edit'鏈接元素中的元素相同(我檢查過),我只是重新創建它,因爲它比從XML中挖掘更容易)。我沒有看到任何問題,但也許我錯過了一些東西。建議?

回答

0

自己解決了。這個問題實際上與在網絡上通過HTTP阻止「PUT」相關。在文檔中使用Google建議的解決方法,使用「POST」使其工作。

相關問題