我需要使用营销Api获得一些自动化的广告洞察。为此,我通过Business Manager创建了一个系统用户,并生成了一个具有ads_read权限的系统用户访问令牌。
然后使用此内标识进行api调用并获取特定活动的洞察,在FacebookAds php v2.6SDK中,我得到以下错误:
Uncaught exception 'FacebookAds\Http\Exception\PermissionException'
with message '(#275) Cannot determine the target object for this
request. Currently supported objects include ad account, business
account and associated objects.'我的应用程序是否需要列入白名单,或者我是否遗漏了其他东西?我注意到在“ads_read”权限的旁边有这样一条说明:“(你的应用必须被列入白名单)”。
下面是我使用的示例代码
<?php
define('VENDOR_DIR', 'vendor/'); // Path to the Vendor directory
$loader = require VENDOR_DIR.'autoload.php';
use FacebookAds\Api;
use FacebookAds\Object\Campaign;
// Initialize a new Session and instantiate an Api object
Api::init(
'xxxxxxxxxxxxxxxx', // App ID
'xxxxxxxxxxxxxxxxx',
'xxxxxxxxxxxxxxxxxx' // System User Access Token
);
$api = Api::instance();
use FacebookAds\Object\Values\InsightsLevels;
$campaign = new Campaign('xxxxxxxxxxxxx');
$params = array(
'level' => InsightsLevels::CAMPAIGN,
);
$async_job = $campaign->getInsightsAsync(array(), $params);
$async_job->read();
while (!$async_job->isComplete()) {
sleep(1);
$async_job->read();
}
$async_job->getResult();
?>发布于 2017-05-17 03:27:51
你的应用似乎没有ads_read权限。在这里你可以找到关于如何请求它的更多信息:https://developers.facebook.com/docs/marketing-api/access
https://stackoverflow.com/questions/37546058
复制相似问题