Blogger API在put请求中返回400以编辑URI

时间:2011-02-02 21:48:38

标签: javascript prototypejs gdata blogger

我正在尝试使用Google提供的协议API更新Blogger帖子。我创建的新帖子工作正常,但更新导致我出现问题。我有以下代码(Javascript):

        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中挖出它更容易)。我没有看到任何问题,但也许我错过了一些东西。建议?

1 个答案:

答案 0 :(得分:0)

自己解决了。该问题实际上与网络上的HTTP阻止“PUT”有关。使用Google建议的解决方法在文档中使用“POST”使其正常工作。