0

Question: How to delete an application request using the facebook-actionscript-api?

I am trying to delete application requests making this call in Actionscript:

Facebook.api(full_request_id, callback, "delete", "POST");

The Actionscript API then throws the following error:

Exception fault: ReferenceError: Error #1069: Property access_token not found on String and there is no default value. at com.facebook.graph.core::AbstractFacebook/api()[C:\Users\facebookGraphApi\api\com\facebook\graph\core\AbstractFacebook.as:134

Which is logical as the script at that point tries to access the value of params which is now the String "delete":

if (params.access_token == null) { params.access_token = accessToken; }

Related questions: AS3 API: Deleting App Invites

Community
  • 1
  • 1
Lubach
  • 113
  • 7

2 Answers2

0

Is 'params' null or not an object? that would easily explain why 'access_token' isn't coming back when you try to access params.access_token

Igy
  • 43,710
  • 8
  • 89
  • 115
  • 'params' is an object of type String, i.e. "delete" in the call: `Facebook.api(full_request_id, callback, "delete", "POST");` From the documentation, this is how to make the Javascript call: `FB.api(requestId, 'delete', function(response) { console.log(response); });` How would I make the same call in Actionscript? – Lubach Dec 09 '11 at 14:10
  • Well if it's a string, that's why you can't call params.access_token - unfortunately i'm not sure how to supply an access token in the AS SDK – Igy Dec 09 '11 at 14:33
  • Found the answer: var full_request_id : String = request_id + "_" + user_id; var method : String = "/" + full_request_id; Facebook.deleteObject(method, callback); *@see AbstractFacebook.as* The actionscript-api will then add the property 'method' with value 'delete' to the parameters of your call: protected function deleteObject(method:String, callback:Function = null):void { var params:Object = {method:'delete'}; api(method, callback, params, URLRequestMethod.POST); } – Lubach Dec 09 '11 at 15:14
0

The following worked for removal of application requests:

var full_request_id : String = request_id + "_" + user_id;
var method : String =  "/" + full_request_id;
Facebook.deleteObject(method, callback);

@see AbstractFacebook.as The actionscript-api will then add the property 'method' with value 'delete' to the parameters of your call:

protected function deleteObject(method:String, callback:Function = null):void {
        var params:Object = {method:'delete'};
        api(method, callback, params, URLRequestMethod.POST);
    }

if (params.access_token == null) { params.access_token = accessToken; }
Lubach
  • 113
  • 7