简体   繁体   中英

Facebook Ads API try connection error - (Unsupported get request. Object with ID 'act_)

I am trying to do the first connection with the Facebook ADs And I used the Quickstart code example using PHP:

在此处输入图片说明

Then I create the following code:

public function start(){
    $api = Api::init($this->_app_id, $this->_app_secret, $this->_access_token);
    $api->setLogger(new CurlLogger());

   $fields = array( 'campaign_name','campaign_id' );
    $params = array(
    'level' => 'campaign',
    'filtering' => array(array('field' => 'delivery_info','operator' => 'IN','value' => array('active','scheduled','completed','recently_completed','archived','permanently_deleted')),array('field' => 'objective','operator' => 'IN','value' => array('CANVAS_APP_ENGAGEMENT','MOBILE_APP_ENGAGEMENT')),array('field' => 'updated_time','operator' => 'GREATER_THAN','value' => 1580014800000)),
    'breakdowns' => array('monthly','action_device','ad_id'),
    'time_range' => array('since' => '2019-12-01','until' => '2020-01-01'),
    );
    echo json_encode((new AdAccount($this->_ad_account_id))->getInsights(
    $fields,
    $params
    )->getResponse()->getContent(), JSON_PRETTY_PRINT);
}

But I am always getting this error:

Unsupported get request. Object with ID 'act_xxxxxxxxxxxxx' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api

I could see this into the settings I have this information:

在此处输入图片说明

Just to help if someone has the same problem:

I solved it.

The solution is simple, to get the correct Ad Account ID Visit the following link. with your valid access token. https://graph.facebook.com/v5.0/me/adaccounts?access_token=

Hope it was helpful.

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