Версия API Graph

Post Insights

Чтение

New Page Experience

This endpoint is supported for New Page Experience.

Пример

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

Параметры

ПараметрОписание
date_preset
enum{today, yesterday, this_month, last_month, this_quarter, maximum, data_maximum, last_3d, last_7d, last_14d, last_28d, last_30d, last_90d, last_week_mon_sun, last_week_sun_sat, last_quarter, last_year, this_week_mon_today, this_week_sun_today, this_year}

Preset a date range, like lastweek, yesterday. If since or until presents, it does not work.

metric
list<A valid metric for an insights endpoint>

The list of metrics that needs to be fetched

period
enum{day, week, days_28, month, lifetime, total_over_range}

The aggregation period

since
datetime

Lower bound of the time range to consider

until
datetime

Upper bound of the time range to consider

Поля

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

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

data

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

paging

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

Error Codes

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

Создание

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

Обновление

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

Удаление

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