Версия API Graph

Ad Account Account Controls

Чтение

Get default fields on an AdAccountBusinessConstraints node associated with this AdAccount. Refer to the AdAccountBusinessConstraints reference for a list of these fields and their descriptions.

Пример

Graph API Explorer
GET /v19.0/{ad-account-id}/account_controls 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(
    '/{ad-account-id}/account_controls',
    '{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(
    "/{ad-account-id}/account_controls",
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/{ad-account-id}/account_controls",
    null,
    HttpMethod.GET,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/{ad-account-id}/account_controls"
                                      parameters:params
                                      HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];
Чтобы узнать, как использовать API Graph, ознакомьтесь с нашим руководством по API Graph.

Параметры

Эта конечная точка не содержит параметров.

Поля

При чтении с данной границы контекста будет возвращен результат в формате JSON:

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

data

Список узлов «AdAccountBusinessConstraints».

paging

Для получения дополнительных сведений о пагинации смотрите Руководство по API Graph.

Error Codes

ОшибкаОписание
100Invalid parameter
190Invalid OAuth 2.0 Access Token
200Permissions error

Создание

Вы можете сделать запрос POST к границе account_controls из этих местоположений:
При размещении публикации на этой границе создается an AdAccountBusinessConstraints.

Параметры

ПараметрОписание
audience_controls
JSON or object-like arrays

audience_controls

Обязательно
age_min
int64

geo_locations
JSON or object-like arrays

excluded_geo_locations
JSON or object-like arrays

exclusions
JSON or object-like arrays

placement_controls
JSON or object-like arrays

This field contains another field called placement_exclusion that provides information on which placements need to be excluded while targeting. All the other placements will be included. Each placement is denoted by a string that concatenates the publisher platform of the placement and a position inside the publisher platform, separated by an underscore. What is provided as parameter is a list of placements. For e.g. If we want to exclude the rewarded videos position from the audience network publisher platform, we provide the field as follows: { "placement_controls": { "placement_exclusions": ["audience_network_rewarded_video"] } } Only a few placements are allowed to be excluded: audience_network_classic (native, banner & interstitial positions of audience network) audience_network_rewarded_video (rewarded videos of audience network) audience_network_instream_video (instream videos of audience network) facebook_marketplace (marketplace section inside facebook) facebook_rhc (right hand column inside facebook)

placement_exclusions
array<enum {AUDIENCE_NETWORK_CLASSIC, AUDIENCE_NETWORK_REWARDED_VIDEO, AUDIENCE_NETWORK_INSTREAM_VIDEO, FACEBOOK_MARKETPLACE, FACEBOOK_RIGHT_HAND_COLUMN}>

Тип возврата

Struct {
id: string,
success: bool,
error_code: string,
error_message: string,
}

Error Codes

ОшибкаОписание
100Invalid parameter
2641Your ad includes or excludes locations that are currently restricted

Обновление

Use the POST /act_<AD_ACCOUNT_ID>/account_controls endpoint to update the AdAccountBusinessConstraints associated with this AdAccount.

Нельзя выполнить эту операцию в этой конечной точке.

Удаление

Нельзя выполнить эту операцию в этой конечной точке.