問題描述
使用 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 評論刪除錯誤的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!