I am using facebook's official sdk for unity in my unity game. I am able to send/get request using FB.AppRequest and FB.API(/USER_ID/apprequests, Facebook.HttpMethod.GET, MY_Callback) and the I am also able to read individual request using FB.API(/REQUEST_ID, Facebook.HttpMethod.GET, Callback). But I am unable to delete request using FB.API(/Request_Id, Facebook.HttpMethod.DELETE, callback). I am getting this error while trying to delete a particular request
09-23 17:45:05.798: E/Unity(3235): Web Error: java.io.FileNotFoundException:https://graph.facebook.com/MY_REQUEST_ID
Below is the exact the code I using
FB.API("/"+FB.UserId+"/apprequests", Facebook.HttpMethod.GET, GiftCallback);
function GiftCallback(response:String){
Debug.Log(response);
var giftResponse = JSON.Parse(response);
if (giftResponse["data"][0]["data"].Value == "life"){
Debug.Log("Life request found");
FB.API("/"+giftResponse["data"][0]["id"].Value+"?access_token=Access_TOKEN", HttpMethod.DELETE, GiftConfirmCallback);
Debug.Log("Delete request has been called");
Debug.Log("Request id is"+giftResponse["data"][0]["id"].Value);
} else {
Debug.Log("No life request found");
}
}
function GiftConfirmCallback(response:String){
Debug.Log("Gift Request delete confirmation");
}
Now I am getting all the debugs correctly except the last one which is not getting printed anywhere.
Debug.Log("Gift Request delete confirmation");
and when I observed more I found the
Web Error: java.io.FileNotFoundException:https://graph.facebook.com/MY_REQUEST_ID?access_token=ACCESS_TOKEN
while if I run
https://graph.facebook.com/MY_REQUEST_ID?accesstoken=ACCESSTOKEN in browser it gives me the correct apprequest details.
This was a bug in the Facebook Unity SDK. As mentioned by Aaron it will be fixed in the next version of the sdk. If anyone else is in hurry to implement it they can try the latest sdk provided by @aaron in the comment. But keep in mind it is not tested a lot yet and not public till now.