I'm having a status_id and try to post a new comment to:
POST https://graph.facebook.com/STATUS_ID/comments {message: "text" }
I get the result
{
"error": {
"message": "(#200) Cannot access object_id: 10150593515092107",
"type": "OAuthException",
"code": 200
}
}
I can do the same POST for /likes and it works.
If I add a comment to a Photo it also works. I can then use the object_id of a photo but no such field exists on a status.
After two days of struggle i found the answer, at least for regular posts.
Every object_id
of a post on facebook consists from two parts: [author id]_[post id]
you can see it clearly in the permalink: https://www.facebook.com/permalink.php?story_fbid=[post id]&id=[author id]
so when you use the full id it seems to work!
Now the real question is why isn't it propertly documented by facebook?!? and to who can I write an angry letter for wasting my time.
it still doesn't work for videos or photos for example because I don't know what is the proper ID's for them and it isn't written anywhere. So if you succeed please let me know.
here is a practical solution I use knowing that for some objects the userid is needed and for some it is not (for comments and likes).
var message = 'WHATEVER MESSAGE';
FB.api('/'+object_id+'/comments','post',{
message:message
},function(r){
if (!r || r.error) {
// if it fails,send it back with the fbid on it
FB.api('/'+fbme.id+'_'+object_id+'/comments','post',{
message:message
},function(r){
if (!r || r.error) {
// if it fails again send back to server side for failure recording
$.post("actions.php",{
req:'badPost',
oid:object_id
},function(n){
});
}
});
}
});
this works for me
来源:https://stackoverflow.com/questions/9377922/post-new-comment-to-a-status-via-api