I am using Unity3D 4.3.4 Editor and Facebook SDK for Unity 5.1 which allows for testing inside the Editor. I am able to suceesfully post screenshots of my game, but I am struggling trying to post a score.
I based my code on this two samples: Facebook Graph API and Facebook SDK Unity Tutorial . In the callback method when I inspect the result object, I get:
400 Bad Request
If I change the method from POST to GET, I don't get the error, but the score is not posted either. But at least I know the score and access_token are being sent.
Here is what the Proxy (Fiddler) captures, but I was unable to capture the POST, only the GET.
GET /me/scores?score=89&access_token=CAAIx1MAZCucgBAEh8LvPA5A4JGuUBSAre0WGhQRZC11WHEgFh1KQJNnsbOEjN5ppeqfumfazmS6CIrZCRlJEKNVhU9wtZCJJ66d3sJqBQYyAbSpBnNIrLN70hJ91uJbEXRD1HwITbViziv9ZC1vhLleyKOILrN97DItP1DnGbzP0y0xoKmVA4RN42Shb716EUEY49wZBlsXXXXXX& HTTP/1.1
Here is my code:
private IEnumerator PostHighScore()
{
yield return 0;
int highScore;
highScore = (int)LevelGenerator.Instance.distance;
Dictionary<string, string> wwwForm = new Dictionary<string, string>();
wwwForm["score"] = highScore.ToString();
Log("Just about to POST to /me/scores");
FB.API("/me/scores", Facebook.HttpMethod.POST, PostHighScoreCallback, wwwForm);
}