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
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; }