Phiên bản API Đồ thị

Ad Account Reachestimate

Đọc

Used to get the audience size estimation based on a targeting specification using this ad account. This endpoint returns a range-based size in the form of two fields: users_lower_bound and users_upper_bound.

Limitations

Reach estimates for custom audiences may not be available for certain businesses.

Ví dụ

Graph API Explorer
GET /v19.0/act_<AD_ACCOUNT_ID>/reachestimate?targeting_spec=%7B%22geo_locations%22%3A%7B%22countries%22%3A%5B%22US%22%5D%7D%2C%22age_min%22%3A20%2C%22age_max%22%3A40%7D 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(
    '/act_<AD_ACCOUNT_ID>/reachestimate?targeting_spec=%7B%22geo_locations%22%3A%7B%22countries%22%3A%5B%22US%22%5D%7D%2C%22age_min%22%3A20%2C%22age_max%22%3A40%7D',
    '{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(
    "/act_<AD_ACCOUNT_ID>/reachestimate",
    {
        "targeting_spec": "{\"geo_locations\":{\"countries\":[\"US\"]},\"age_min\":20,\"age_max\":40}"
    },
    function (response) {
      if (response && !response.error) {
        /* handle the result */
      }
    }
);
Bundle params = new Bundle();
params.putString("targeting_spec", "{\"geo_locations\":{\"countries\":[\"US\"]},\"age_min\":20,\"age_max\":40}");
/* make the API call */
new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/act_<AD_ACCOUNT_ID>/reachestimate",
    params,
    HttpMethod.GET,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();
NSDictionary *params = @{
  @"targeting_spec": @"{\"geo_locations\":{\"countries\":[\"US\"]},\"age_min\":20,\"age_max\":40}",
};
/* make the API call */
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                               initWithGraphPath:@"/act_<AD_ACCOUNT_ID>/reachestimate"
                                      parameters:params
                                      HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                      id result,
                                      NSError *error) {
    // Handle the result
}];
curl -X GET -G \
  -d 'targeting_spec={
       "geo_locations": {
         "countries": [
           "US"
         ]
       },
       "age_min": 20,
       "age_max": 40
     }' \
  -d 'access_token=<ACCESS_TOKEN>' \
  https://graph.facebook.com/v19.0/act_<AD_ACCOUNT_ID>/reachestimate
Nếu bạn muốn tìm hiểu cách sử dụng API Đồ thị, hãy đọc Hướng dẫn sử dụng API Đồ thị của chúng tôi.

Thông số

Thông sốMô tả
object_store_url
string

Used in mobile app campaign. The url of the app in the app store.

targeting_spec
Targeting object

The targeting structure for reach estimate. countries is required. See targeting.

Bắt buộc

Trường

Đọc từ cạnh này sẽ trả về một kết quả JSON đã định dạng:

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

data

A single AdAccountReachEstimate node.

paging

Để biết thêm chi tiết về chia trang, hãy xem hướng dẫn về API Đồ thị.

Mã lỗi

LỗiMô tả
2635You are calling a deprecated version of the Ads API. Please update to the latest version.
100Invalid parameter
80004There have been too many calls to this ad-account. Wait a bit and try again. For more info, please refer to https://developers.facebook.com/docs/graph-api/overview/rate-limiting#ads-management.
613Calls to this api have exceeded the rate limit.
2641Your ad includes or excludes locations that are currently restricted
190Invalid OAuth 2.0 Access Token
200Permissions error
415Two factor authentication required. User have to enter a code from SMS or TOTP code generator to pass 2fac. This could happen when accessing a 2fac-protected asset like a page that is owned by a 2fac-protected business manager.
105The number of parameters exceeded the maximum for this operation

Tạo

Bạn không thể thực hiện thao tác này trên điểm cuối này.

Cập nhật

Bạn không thể thực hiện thao tác này trên điểm cuối này.

Xóa

Bạn không thể thực hiện thao tác này trên điểm cuối này.