简体   繁体   中英

Facebook ads "<CAMPAIGN-ID>/insights" endpoint returns error

In PHP SDK when I try to fetch the insights of a campaign using "/insights" endpoint, it returns error:

You are calling a deprecated version of the Ads API. Please update to the latest version: v11.0.

The version of my app and php-ads-sdk is v11.0.

When I tested the endpoint in Graph API explorer, it's working.

$fb = new Facebook([
    'app_id' => $app_id,
    'app_secret' => $app_secret,
]);
$response = $fb->get(
      '<CAMPAIGN_ID>/insights?fields=actions',
      $access_token,
);

NB: A valid campaign id is used.

I believe you can prepend the version in your call, could not be a guaranteed fix but worth trying:

$response = $fb->get(
      'https://graph.facebook.com/v11.0/<CAMPAIGN_ID>/insights?fields=actions',
      $access_token,
);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM