Facebook Ads SDK - 不支持的帖子请求

时间:2018-04-17 09:03:17

标签: php facebook facebook-graph-api facebook-marketing-api

我从Facebook App Management获得了一些示例脚本来使用Marketing API。当我运行脚本时,我只是通过curl得到了这个错误:

'Unsupported post request. Object with ID \'105101623679981\' does not exist, cannot be loaded due to missing permissions, or does not support this operation.

我已经尝试停用沙盒模式并上线,尝试了不同语言的许多不同脚本以及其他密钥。

任何想法?

这是剧本:

<?php
//Add all those Uses and the autoloader

$access_token = '<my_very_long_accessToken';
$ad_account_id = '<my_account_id>'; //<-- This is the Object in the Error Code
$app_secret = '<my_app_secret>';
$page_id = '<my_page_id>';
$app_id = '<my_app_is>';

$api = Api::init($app_id, $app_secret, $access_token);
$api->setLogger(new CurlLogger());

$fields = array(
);
$params = array(
  'objective' => 'PAGE_LIKES',
  'status' => 'PAUSED',
  'buying_type' => 'AUCTION',
  'name' => 'My Campaign',
);
$campaign = (new AdAccount($ad_account_id))->createCampaign(
  $fields,
  $params
);
$campaign_id = $campaign->id;
echo 'campaign_id: ' . $campaign_id . "\n\n";

$fields = array(
);
$params = array(
  'status' => 'PAUSED',
  'targeting' => array('geo_locations' => array('countries' => array('US'))),
  'daily_budget' => '1000',
  'billing_event' => 'IMPRESSIONS',
  'bid_amount' => '20',
  'campaign_id' => $campaign_id,
  'optimization_goal' => 'PAGE_LIKES',
  'promoted_object' => array('page_id' =>  $page_id),
  'name' => 'My AdSet',
);
//...

1 个答案:

答案 0 :(得分:0)

呀。我知道了。它必须是“行为_”

太糟糕了。脚本真的很糟糕。这么多错误。它是由facebook创建的!