Facebook SDK和Graph API注释删除错误 [英] Facebook SDK and Graph API Comment Deleting Error

查看:100
本文介绍了Facebook SDK和Graph API注释删除错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



起初我在使用Facebook php SDK,我很想知道如何删除评论,因为它的id和xid。 REST API,您可以在其中调用comments_remove($ xid,$ id);来删除注释。当xid参数只接受字母数字字符和下划线时,会出现此方法的问题。
根据文档( http://developers.facebook.com/docs / reference / fbml / comments )有效的XID可以是任何url_encode的结果。



现在我正在用新的GRAPH api测试我的运气。请参阅删除对象下的 http://developers.facebook.com/docs/api 看来,删除留言是绝对支持的。但是,我已经尝试发送DELETE请求,并且还尝试使用参数'method = delete'发送POST和GET到对象url。



无论怎样我尝试了,我总是得到相同的错误:



{error:{type:GraphMethodException,message:不支持的删除请求。 }}



我正在发送访问令牌作为参数。我发送的访问令牌是保存在cookie cookie中的访问令牌,从单一的JavaScript cookie开始。这些都是我应用程序的意见。这是否发生在任何人身上,或者我根本不这样做?



任何帮助或指导都是非常感激的。

解决方案

修正!



删除时,您必须将用户ID添加到对象ID中:



删除 https://graph.facebook.com/673509687_104812882909249?access_token = {access_token}
其中
673509687是我的userID,104812882909249是objectID


Working with the Facebook php SDK's, I am having a lot of trouble figuring out how to delete comments, given its id and xid.

At first I was using the REST API, where you can call 'comments_remove($xid, $id);' to delete a comment. The problem with this method came when the xid parameter only accepts alphanumeric characters and underscores. Based on the documentation (http://developers.facebook.com/docs/reference/fbml/comments ) a valid XID can be the result of any url_encode.

Now I am testing my luck with the new GRAPH api. Looking at http://developers.facebook.com/docs/api under 'Deleting Objects', It seems that comment deleting is definitely supported. However, I have tried sending a DELETE request, and I have also tried sending POST and GET to the object url with the argument 'method=delete'.

No matter how I try it, I always get the same error:

{"error":{"type":"GraphMethodException","message":"Unsupported delete request."}}

I am sending the access token as a parameter as well. The access token that I am sending is the access token saved in the facebook cookie from the single sign on javascript cookie. These are all comments made on my application. Does this happen to anyone else, or am I simply not doing this right?

Any help or guidance is GREATLY appreciated.

解决方案

Fixed!

You have to prepend the userid to the object ID when deleting:

DELETE https://graph.facebook.com/673509687_104812882909249?access_token={access_token} where 673509687 is my userID and 104812882909249 is the objectID

这篇关于Facebook SDK和Graph API注释删除错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆