Bonswouar
Bonswouar

Reputation: 1590

Facebook API : Can't retrieve score

I'm using the Facebook Graph API with the PHP SDK.

I've logged in, with all permissions needed (full list is : email,publish_actions,user_friends,user_games_activity).


What happened with score and application fields (as specified in the documentation) ?!

Upvotes: 1

Views: 107

Answers (1)

Bonswouar
Bonswouar

Reputation: 1590

Just found out what was the mistake (although it's not very clear in the documentation imo).

I have to specify which fields are returned in the GET request.

For example : $fb->api("/me/scores?fields=score,user,application",'GET');

Which returns :

{
  "data": [
    {
      "score": 5,
      "user": {
        "name": "Name_of_the_FB_account",
        "id": "FB_ACCOUNT_ID"
      },
      "application": {
        "category": "Games",
        "link": "https://www.facebook.com/application-path/",
        "name": "ApplicationName",
        "namespace": "application_namespace",
        "id": "APPLICATION_ID"
      }
    }
  ]
}

By the way there is also type field in the documentation, which apparently doesn't exist.

EDIT : As @YassineGuedidi pointed it out, this is a normal behaviour (but breifly documented) since Graph API 2.4

Upvotes: 1

Related Questions