Facebook SDK 和 Graph API 评论删除错误

Facebook SDK and Graph API Comment Deleting Error(Facebook SDK 和 Graph API 评论删除错误)
本文介绍了Facebook SDK 和 Graph API 评论删除错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

使用 Facebook php SDK 时,考虑到评论的 id 和 xid,我在弄清楚如何删除评论时遇到了很多麻烦.

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.

起初我使用的是 REST API,您可以在其中调用 'comments_remove($xid, $id);'删除评论.当 xid 参数只接受字母数字字符和下划线时,此方法就会出现问题.基于文档 (http://developers.facebook.com/docs/reference/fbml/comments ) 一个有效的 XID 可以是任何 url_encode 的结果.

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.

现在我正在使用新的 GRAPH api 测试我的运气.在删除对象"下查看 http://developers.facebook.com/docs/api, 看来是肯定支持删除评论了.但是,我尝试发送 DELETE 请求,并且还尝试使用参数method=delete"向对象 url 发送 POST 和 GET.

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":"不支持的删除请求."}}

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

我也将访问令牌作为参数发送.我发送的访问令牌是从 javascript cookie 上的单点登录保存在 facebook cookie 中的访问令牌.这些都是对我的申请的评论.这是否发生在其他人身上,或者我只是做错了?

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.

推荐答案

已修复!

删除时必须在对象 ID 前面加上用户 ID:

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

删除https://graph.facebook.com/673509687_104812882909249?access_token?access_token}在哪里673509687 是我的用户 ID,104812882909249 是对象 ID

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 评论删除错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Facebook Login with Strict Mode for Redirect URIs(使用重定向 URI 的严格模式登录 Facebook)
How to retrieve post ID for a post i#39;ve just made via the Facebook API(如何检索我刚刚通过 Facebook API 发布的帖子的帖子 ID)
Facebook PHP SDK logout(Facebook PHP SDK 注销)
PHP amp; Facebook: facebook-debug a URL using CURL and Facebook debugger(PHP amp;Facebook: facebook-debug a URL using CURL and Facebook debugger)
Can#39;t delete photo via Facebook API?(无法通过 Facebook API 删除照片?)
Create and Configure Facebook Apps via API(通过 API 创建和配置 Facebook 应用)