Graph API Version

/{user-id}/scores

The scores this person has received from Facebook Games that they've played.

Reading

Graph API Explorer
GET /v2.10/me/scores HTTP/1.1
Host: graph.facebook.com
/* PHP SDK v5.0.0 */
/* make the API call */
$request = new FacebookRequest(
  $session,
  'GET',
  '/me/scores'
);
$response = $request->execute();
$graphObject = $response->getGraphObject();
/* handle the result */
/* make the API call */
FB.api(
    "/me/scores",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/me/scores",
    null,
    HttpMethod.GET,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
// For more complex open graph stories, use `FBSDKShareAPI`
// with `FBSDKShareOpenGraphContent`
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/me/scores"
                                      parameters:params
                                      HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];

Permissions

  • An app access token can be used to see the scores that a person has received in that app.
  • A user access token with user_games_activity permission is required to see all scores that person has received from other apps.

Fields

NameDescriptionType

user

The person associated with the scores.

User

score

The actual score.

int

application

The app in which the score was achieved.

App.

Publishing

POST /v2.10/me/scores HTTP/1.1
Host: graph.facebook.com

score=3444
/* PHP SDK v5.0.0 */
/* make the API call */
$request = new FacebookRequest(
  $session,
  'POST',
  '/me/scores',
  array (
    'score' => '3444',
  )
);
$response = $request->execute();
$graphObject = $response->getGraphObject();
/* handle the result */
/* make the API call */
FB.api(
    "/me/scores",
    "POST",
    {
        "score": "3444"
    },
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
Bundle params = new Bundle();
params.putString("score", "3444");
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/me/scores",
    params,
    HttpMethod.POST,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
// For more complex open graph stories, use `FBSDKShareAPI`
// with `FBSDKShareOpenGraphContent`
NSDictionary *params = @{
  @"score": @"3444",
};
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/me/scores"
                                      parameters:params
                                      HTTPMethod:@"POST"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];

Permissions

The Scores API is available only for apps that are categorized as Games and have already been granted the publish_actions permission in the past.

Please note that publish_actions will not be granted for new apps with the sole purpose of accessing this API.

  • A user access token with publish_actions permission can be used to publish scores for that person.
  • An app access token can be used if publish_actions permission was previously granted.

Fields

NameDescriptionType

score

The score that you want to set for this person.

int

Response

If successful:

{
  "success": true
}

Otherwise a relevant error message will be returned.

Deleting

You can delete the score this person has received from your app only.

DELETE /v2.10/me/scores HTTP/1.1
Host: graph.facebook.com
/* PHP SDK v5.0.0 */
/* make the API call */
$request = new FacebookRequest(
  $session,
  'DELETE',
  '/me/scores'
);
$response = $request->execute();
$graphObject = $response->getGraphObject();
/* handle the result */
/* make the API call */
FB.api(
    "/me/scores",
    "DELETE",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/me/scores",
    null,
    HttpMethod.DELETE,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
// For more complex open graph stories, use `FBSDKShareAPI`
// with `FBSDKShareOpenGraphContent`
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/me/scores"
                                      parameters:params
                                      HTTPMethod:@"DELETE"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];

Permissions

The Scores API is available only for apps that are categorized as Games and have already been granted the publish_actions permission in the past.

Please note that publish_actions will not be granted for new apps with the sole purpose of accessing these APIs.

  • A user access token with publish_actions permission can be used to delete scores (from this app) for that person.
  • An app access token can be used if publish_actions permission was previously granted.

Fields

No fields are required to delete.

Response

If successful:

{
  "success": true
}

Otherwise a relevant error message will be returned.

Updating

You can update a person's score for your app by publishing a new score.