Graph API Version

User Achievements

The Graph API for achievements enables you to publish achievements in your game so players can tell more meaningful and relevant stories.

Using the /{user-id}/achievements edge you can publish a new achievement for a user, read the achievements that a user has already collected, or delete an achievement collected.

Achievements APIManage User Achievements

Reading

Open Graph actions of type games.achieves taken by the User

Graph API Explorer
GET /v2.8/{user-id}/achievements HTTP/1.1
Host: graph.facebook.com
/* PHP SDK v5.0.0 */
/* make the API call */
$request = new FacebookRequest(
  $session,
  'GET',
  '/{user-id}/achievements'
);
$response = $request->execute();
$graphObject = $response->getGraphObject();
/* handle the result */
/* make the API call */
FB.api(
    "/{user-id}/achievements",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{user-id}/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:@"/{user-id}/achievements"
                                      parameters:params
                                      HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];

Permissions

Developers usually request these permissions for this endpoint:

Marketing Apps
No data
Page management Apps
No data
Other Apps
Permissions are not usually requested.

Parameters

NameDescription
app_id_filter
int

If set, only actions produced by this app will be returned

object
ID or url associated with the Open Graph Object

If set, only action associated with this object will bereturned

type
numeric string or integer

If set, only action associated with this object will bereturned

Fields

Reading from this edge will return a JSON formatted result:

{ "data": [], "paging": {} }

data

A list of OpenGraphAction:games.achieves nodes.

paging

For more details about pagination, see the Graph API guide.

Validation Rules

ErrorDescription
100Invalid parameter

Creating

You can't perform this operation on this endpoint.

Updating

You can't perform this operation on this endpoint.

Deleting

You can't perform this operation on this endpoint.