Graph API Version

Graph API Reference /{app-id}/banned

The people banned from using this app.

Reading

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

Permissions

  • An app access token for the app is required.

Fields

A list of banned users is returned.

If some user isn't visible for the app (i.e. they have disabled the platform or blocked the app) - they won't be included in the results, although banning/unbanning will still work.

Publishing

By publishing using this edge, you ban people from using an app:

POST /v2.10/{app-id}/banned HTTP/1.1
Host: graph.facebook.com

uid=1234
/* PHP SDK v5.0.0 */
/* make the API call */
$request = new FacebookRequest(
  $session,
  'POST',
  '/{app-id}/banned',
  array (
    'uid' => '1234',
  )
);
$response = $request->execute();
$graphObject = $response->getGraphObject();
/* handle the result */
Bundle params = new Bundle();
params.putString("uid", "1234");
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{app-id}/banned",
    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 = @{
  @"uid": @"1234",
};
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/{app-id}/banned"
                                      parameters:params
                                      HTTPMethod:@"POST"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];

Permissions

  • An app access token is required to ban anyone from using that app.

Fields

NameDescriptionType

uid

List of user IDs of people to be banned.

csv<int>

Response

If successful:

{
  "success": true
}

Otherwise a relevant error message will be returned.

Deleting

You can un-ban someone from an app using this edge:

DELETE /v2.10/{app-id}/banned HTTP/1.1
Host: graph.facebook.com

uid=1234
/* PHP SDK v5.0.0 */
/* make the API call */
$request = new FacebookRequest(
  $session,
  'DELETE',
  '/{app-id}/banned',
  array (
    'uid' => '1234',
  )
);
$response = $request->execute();
$graphObject = $response->getGraphObject();
/* handle the result */
Bundle params = new Bundle();
params.putString("uid", "1234");
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{app-id}/banned",
    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 = @{
  @"uid": @"1234",
};
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/{app-id}/banned"
                                      parameters:params
                                      HTTPMethod:@"DELETE"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];

Permissions

  • An app access token is required to un-ban anyone from that app.

Fields

NameDescriptionType

uid

The ID of the test user to be un-banned from the app.

int

Response

If successful:

{
  "success": true
}

Otherwise a relevant error message will be returned.