This document refers to a feature that was removed after Graph API v3.2.
Graph API Version

/{user-id}/achievements

The games achievements that the user has received.

Related Guides

Reading

Graph API Explorer
GET /v4.0/me/achievements HTTP/1.1
Host: graph.facebook.com
/* PHP SDK v5.0.0 */
/* make the API call */
try {
  // Returns a `Facebook\FacebookResponse` object
  $response = $fb->get(
    '/me/achievements',
    '{access-token}'
  );
} catch(Facebook\Exceptions\FacebookResponseException $e) {
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}
$graphNode = $response->getGraphNode();
/* handle the result */
/* make the API call */
FB.api(
    "/me/achievements",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/me/achievements",
    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/achievements"
                                      parameters:params
                                      HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];

Permissions

  • An app access token is required to return achievements for that person in the same app.
  • A user access token with user_games_activity permission is required to return achievements by that person for any other apps.

Fields

Reading this endpoint returns an array of Achievement objects with the same fields as that node.

Publishing

POST /v4.0/me/achievements HTTP/1.1
Host: graph.facebook.com

achievement=%7Burl-of-achievement-type%7D
/* PHP SDK v5.0.0 */
/* make the API call */
try {
  // Returns a `Facebook\FacebookResponse` object
  $response = $fb->post(
    '/me/achievements',
    array (
      'achievement' => '{url-of-achievement-type}',
    ),
    '{access-token}'
  );
} catch(Facebook\Exceptions\FacebookResponseException $e) {
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}
$graphNode = $response->getGraphNode();
/* handle the result */
/* make the API call */
FB.api(
    "/me/achievements",
    "POST",
    {
        "achievement": "{url-of-achievement-type}"
    },
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
Bundle params = new Bundle();
params.putString("achievement", "{url-of-achievement-type}");
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/me/achievements",
    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 = @{
  @"achievement": @"{url-of-achievement-type}",
};
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/me/achievements"
                                      parameters:params
                                      HTTPMethod:@"POST"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];

Permissions

  • An user access token with publish_actions is required.
  • An app access token can be used if someone has already granted publish_actions.

Fields

NameDescriptionType

achievement

The unique URL of the type of achievement that the person will receive. This is required.

string

Response

NameDescriptionType

id

The ID of this person's instance of the achievement.

string

Deleting

DELETE /v4.0/me/achievements HTTP/1.1
Host: graph.facebook.com

achievement=%7Burl-of-achievement-to-delete%7D
/* PHP SDK v5.0.0 */
/* make the API call */
try {
  // Returns a `Facebook\FacebookResponse` object
  $response = $fb->delete(
    '/me/achievements',
    array (
      'achievement' => '{url-of-achievement-to-delete}',
    ),
    '{access-token}'
  );
} catch(Facebook\Exceptions\FacebookResponseException $e) {
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}
$graphNode = $response->getGraphNode();
/* handle the result */
/* make the API call */
FB.api(
    "/me/achievements",
    "DELETE",
    {
        "achievement": "{url-of-achievement-to-delete}"
    },
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
Bundle params = new Bundle();
params.putString("achievement", "{url-of-achievement-to-delete}");
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/me/achievements",
    params,
    HttpMethod.DELETE,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
// For more complex open graph stories, use `FBSDKShareAPI`
// with `FBSDKShareOpenGraphContent`
NSDictionary *params = @{
  @"achievement": @"{url-of-achievement-to-delete}",
};
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/me/achievements"
                                      parameters:params
                                      HTTPMethod:@"DELETE"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];

Permissions

  • An user access token with publish_actions is required.
  • An app access token can be used if someone has already granted publish_actions.

Fields

NameDescriptionType

achievement

The unique URL of the type of achievement you want to delete. This is required.

string

Response

If successful:

{
  "success": true
}

Otherwise a relevant error message will be returned.

Updating

You can't perform updates on this edge.