-1

I'm fairly new to the Facebook API, so I did some research and came across the Stack Overflow post Cannot delete application invite in Facebook after acceptance

I thought it would work for me since I have the same issue. However, I have not made any progress with any variations of the suggested methods in the post above.

These are the two variations I've been trying:

A:

=============================

FB.api('/'+request_id, 'DELETE', function(fb_response) {
    if (typeof callbackFunction == 'function') {
        callbackFunction(fb_response);
    }
});

B:

===================

FB.api("/", "POST", {
    access_token:"MY_APPLICATION_ACCESS_TOKEN",
    batch:[
        {
                "method":"DELETE",
                "name":request_id,
                //"omit_response_on_success": true,

        }
    ]
}, function(fb_response) {
    callbackFunction(fb_response);
});

I'm still getting this error message:

message:"(#2) Invalid parameter: Unknown error"

type:"OAuthException"

How do I fix this problem?

Community
  • 1
  • 1
Thillypickle
  • 31
  • 1
  • 5
  • You should really be doing that as a server side call, otherwise you'd need to have your app's access token available to the user's browser which is a massive security issue for your app - it's also easier to debug if it's server side. – Igy Sep 09 '11 at 17:54
  • well i've tried doing the graph api call manually through the browser to test it out as it would be done via PHP side through a curl call but i get the same error. ` https://graph.facebook.com/request_id?access_token=ACCESS_TOKEN&method=DELETE ` this is what i assume the call does through graph api. – Thillypickle Sep 09 '11 at 18:05
  • Yeah, as per my answer on the other question you linked that should be working Are you able to access the requests (i.e a `GET` request) OK? If not, there may be some other issue, because your app's access token should work for both – Igy Sep 09 '11 at 18:10
  • My gets are fine with the access token and such i just did it a few mins ago. it's the DELETE that hasn't been working griefing me for the past few weeks. – Thillypickle Sep 09 '11 at 18:15
  • not sure if this helps or not but i ran the delete thing through the Graph API Explorer and it worked fine on there. – Thillypickle Sep 09 '11 at 18:21

2 Answers2

0

These are two ways I am deleting requests through the js api:

Singular:

FB.api(request_id, 'DELETE', function(fb_response) {
    if (fb_response) {
        // Do something
    }
});

Batch:

FB.api("/", "POST", {
  batch:[
    {
            "method":"DELETE",
            "relative_url":request_id, 
    }
  ]
  }, function(fb_response) {
    if (fb_response){  
     // Do Something
    }
});

With the request_id being in the proper format of facebook request_id, underscore, facebook user_id.

Joey
  • 752
  • 1
  • 9
  • 26
0

So it turns out the issue was my access_token. It was grabbing the user token instead of the app_token for some reason, and I decided, as suggested, to move the removable to the PHP side and all was dandy.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Thillypickle
  • 31
  • 1
  • 5