Reputation: 1590
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
).
When I use the scores API it seems to work (I got a "success" to true in return) : $fb->api("/me/scores",'POST', array("score" => "5"));
But then, when I try to retrieve it : $fb->api("/me/scores",'GET');
I've got this response (and the same from the FB Graph API Explorer) :
{
"data": [
{
"user": {
"name": "Name_of_the_FB_account",
"id": "FB_ACCOUNT_ID"
}
}
]
}
What happened with score
and application
fields (as specified in the documentation) ?!
Upvotes: 1
Views: 107
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