GET /v21.0/{photo-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(
'/{photo-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(
"/{photo-id}/insights",
function (response) {
if (response && !response.error) {
/* handle the result */
}
}
);
/* make the API call */
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/{photo-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:@"/{photo-id}/insights"
parameters:params
HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
id result,
NSError *error) {
// Handle the result
}];
Thông số | Mô tả |
---|---|
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 |
Đọc từ cạnh này sẽ trả về một kết quả JSON đã định dạng:
{ "
data
": [], "paging
": {} }
data
paging
Lỗi | Mô tả |
---|---|
200 | Permissions error |
100 | Invalid parameter |
104 | Incorrect signature |
190 | Invalid OAuth 2.0 Access Token |
3001 | Invalid query |