我正在尝试使用javascript API发表评论。我首先获得特定url
的评论列表:
FB.api('/fql', {q: {
query0: 'SELECT comments_fbid FROM link_stat WHERE url="'+url+'"',
query1: 'SELECT post_fbid, fromid, text, time, comments FROM comment WHERE object_id IN (SELECT comments_fbid FROM #query0) ORDER BY time DESC',
query2: 'SELECT id, name FROM profile WHERE id IN (SELECT fromid FROM #query1)'
}}, function(resp) {
...
});
然后我可以发布到页面的comments_fbid
或post_fbid
来回复评论列表中的现有帖子。这些由下面的id
表示:
FB.login(function(resp) {
if (!resp.authResponse) return;
FB.api('/'+id+'/comments', 'post', {message: 'Hello World', function(resp) {
console.log(resp);
});
}, {scope: 'publish_stream'});
如果我发布回复现有消息(即post_fbid
),它可以正常工作,但如果我发布到顶级评论列表(即comments_fbid
),我会得到错误:
{error: {code: 1, message: "An unknown error has occurred.", type: "OAuthException"}}