4

I've looked through this site and looked at the Facebook docs but I can't seem to delete an invite after a friend accepts. So, what happens is: 1. Steve invites John to a game. 2. John receives that invite and clicks accept. 3. John is taken to the game, but the invite message is not delete in his facebook page.

Facebook docs suggests I add "method=delete" when I post to https://graph.facebook.com/[request_id]?access_token=xxxx

But that returns me "{"error":{"type":"OAuthException","message":"(#2) Invalid parameter: Unknown error"}}". I'm pretty sure I'm using the most recent access_token.

Can anyone provide me with sample code which deletes an application invite after a user accepts?

EDIT: I also tried DELETE i.e. DELETE https://graph.facebook.com/[request_id]?access_token=xxxx And I get the same error

Thanks.

rexposadas
  • 3,109
  • 3
  • 27
  • 49

2 Answers2

3

There's brief examples at https://developers.facebook.com/docs/reference/dialogs/requests/ and a longer example on https://developers.facebook.com/blog/post/464/ which show how to do this.

It sounds from your comments on fjsj's answer that you know what you're supposed to be doing - it definitely looks OK to me.

It could be that you're encountering a bug of some kind, but I think in this case it's more likely that somehow the access token of the user is being sent or there's a slight error in the way you're accessing the API - If there's a specific error message you're getting back? maybe post that here if there is.

Two things to check:

  • Is the request you're trying to delete returned when you make a GET request to /<request id>? (using the app access token)

  • Are the requests being sent using the newer Requests 2.0 dialogs? If you're using the older requests system, the instructions are basically the same, but the connection you access the requests at is the [currently undocumented] /<USER>/platformrequests endpoint (as opposed to /<USER>/apprequests

Igy
  • 43,710
  • 8
  • 89
  • 115
  • Did it resolve your problem or was I just restating what 'should' happen? – Igy Sep 07 '11 at 21:05
  • 1
    The links and ideas you wrote led me to the right path. "slight error in the way you're accessing the API" :This line made me investigate how I was making my calls. I was using JSON. I went with XML and that worked. – rexposadas Sep 07 '11 at 23:23
0

Try doing a HTTP DELETE instead of a POST. This is what the documentation says.

fjsj
  • 10,995
  • 11
  • 41
  • 57
  • thanks for the response. unfortunately I get the same error with the DELETE call. I edited my post. – rexposadas Sep 02 '11 at 18:12
  • Just reviewed my app and it its using POST with a method=delete param. But you said that this don't work, so try this (crazy) solution: http://stackoverflow.com/questions/2858748/facebook-api-delete-status/3450885#3450885 – fjsj Sep 02 '11 at 18:22
  • If yours works, then I'm definitely doing something wrong on my side. the request_id is what I get when I land on the canvas page. the access_token is the application's access token. Is that correct? Do you happen to have sample code from your APP that I can look at? and again, thanks for the response. – rexposadas Sep 02 '11 at 18:28
  • Yes, the access_token is the app access_token. The id to be deleted is the first ocurrence of request_ids. My code is in Python, it uses the Graph API python-sdk: `self.request(id, post_args={"method": "delete"})` – fjsj Sep 02 '11 at 19:14