Version API du graphe

Post Insights

Lecture

Nouvelle version des Pages

This endpoint is supported for Nouvelle version des Pages.

Exemple

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
}];
Pour apprendre à utiliser l’API Graph, consultez notre guide Utiliser l’API Graph.

Paramètres

ParamètreDescription
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

Champs

La lecture à partir de cette arête renverra un résultat au format JSON :

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

data

Une liste de nœuds InsightsResult.

paging

Pour plus de détails à propos de la pagination, voir Guide de l’API Graph.

Error Codes

ErreurDescription
100Invalid parameter
200Permissions error
3001Invalid query
190Invalid OAuth 2.0 Access Token

Création

Vous ne pouvez pas effectuer cette opération sur ce point de terminaison.

Mise à jour

Vous ne pouvez pas effectuer cette opération sur ce point de terminaison.

Suppression

Vous ne pouvez pas effectuer cette opération sur ce point de terminaison.