1

I started researching this because I wanted to be able to delete a comment on the wall of a Facebook Event, because the "Remove post" doesn't seem to be applicable to comments on an Event wall. However, since I don't know if it is even possible I decided to see if I could mannually delete a post I made to my own wall first since that is possible. Note I am NOT using any SDK; I am just building the URL and entering it in the address bar in Firefox v3.6.17.

These posts have helped me alot since I am now starting: Delete facebook post with Graph API - trouble getting this to work and Facebook SDK and Graph API Comment Deleting Error

I can see the comment data and all its field via the following:

https://graph.facebook.com/[POST_ID]?access_token=[ACCESS_TOKEN]  
`where [POST_ID] and [ACCESS_TOKEN] were got using the graph API.`

However, where do I put the "method=delete" command in the URL? I tried putting it at the end, like

https://graph.facebook.com/[POST_ID]?access_token=[ACCESS_TOKEN]?method=delete 

but that results in a OAuthException stating "Invalid access token signature" because it seems to read the method as part of the access token.

I tried putting it after the post_id like

https://graph.facebook.com/[POST_ID}?method=delete?access_token=[ACCESS_TOKEN] 

but that results in an Exception (Unsupported method) because it thinks "access_token=[ACCESS_TOKEN]" is part of the method being called.

I see one of the posts cited above states I have to prepend the userid to the object ID when deleting by using

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

But when I enter

DELETE https://graph.facebook.com/[POST_ID}?access_token=[ACCESS_TOKEN]

in the Firefox address bar it doesn't recognize it (I didn't think it would anyway) and uses it as a google search query.

How do I delete a comment if I have the comment_id and my access_token using the web browser?

Community
  • 1
  • 1
V.K.
  • 61
  • 2
  • 2
  • 5
  • I tried it again by sending an HTTP 1.1 DELETE method using a program to send HTTP methods and got the following response: `{"error":{"type":"OAuthException","message":"(#200) The user hasn't authorized the application to perform this action"}}` What am I missing? – V.K. May 15 '11 at 13:46

1 Answers1

4

You have a big problem with your urls :

https://graph.facebook.com/[POST_ID]?access_token=[ACCESS_TOKEN]?method=delete

Should be :

https://graph.facebook.com/[POST_ID]?access_token=[ACCESS_TOKEN] & method=delete

Identically,

https://graph.facebook.com/[POST_ID}?method=delete?access_token=[ACCESS_TOKEN]

should be :

https://graph.facebook.com/[POST_ID}?method=delete  & access_token=[ACCESS_TOKEN]

So you have to use the ? before entering your parameters and then & between each parameter and the order should not have any importance ..

onkar
  • 4,427
  • 10
  • 52
  • 89
dwarfy
  • 3,076
  • 18
  • 22
  • Ah, thanks for that. At least now I could send it with the browser instead of a separate program. The browswer is still returning the same error now though: `{ "error": { "type": "OAuthException", "message": "(#200) The user hasn't authorized the application to perform this action" } }` What application? Do I have to create a FB application just to manipulate the graph (deleting a commnent) ? – V.K. May 15 '11 at 14:44
  • @V.K. Did you ask for `publish_stream` permission when getting your access token ? It's required for publishing/deleting .. – dwarfy May 15 '11 at 14:50
  • @dwarfy How do I do that? I just copied and pasted the access_token from http://developers.facebook.com/docs/reference/api/ . I take it there are different levels of access tokens? (Reminder, I am not using an SDK or Facebook application to do these things right now). – V.K. May 15 '11 at 16:13
  • According to the permission for the access_token `"read_stream": 1` Is the publish_stream permission required in the access_token to be able to delete objects? On a side, for information http://groups.google.com/group/rpx-developers/browse_thread/thread/5cced8c071cec3e3?pli=1 says once read_stream is granted, once can publish posts. – V.K. May 15 '11 at 16:30
  • 1
    Yes you need an application to manipulate the Graph API, else anyone could edit anything, and you wouldn't be able to stop them :/ – Gray May 15 '11 at 17:22
  • Hmmm... I see... guess all the calls must go through the Facebook application for tracing purposes, that seems a lot to do just to be able to delete a post (that I made). I would have to create an application and come back to this (and read up more on access tokens). Wait a minute... how come all the other posts never mentioned anything about needing a facebook application, especially the URI Javascript method to delete an object and the HTTP delete method... where does the application stuff come in? I am assuming now all those commands must be sent from within the application somehow? – V.K. May 15 '11 at 17:48
  • The application is simply used as a method of verification. Every iPhone application you have ever used that uses Facebook connect has a corresponding 'application'. Same with any site using Facebook's single sign-on. You just need to 'create' an application by using the developer app in Facebook and using that to get an auth-token – BeRecursive May 15 '11 at 20:56