Aromal S
Aromal S

Reputation: 1

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.

Upvotes: 0

Views: 135

Answers (1)

Jonathan V.n.
Jonathan V.n.

Reputation: 43

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,
);

Upvotes: 0

Related Questions