Facebook ads API:ID为'*****************'的对象不存在,由于缺少权限而无法加载 [英] Facebook ads API : Object with ID '*****************' does not exist, cannot be loaded due to missing permissions

查看:265
本文介绍了Facebook ads API:ID为'*****************'的对象不存在,由于缺少权限而无法加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用facebook ads API(3.2),但出现一些奇怪的错误.我正在尝试获取campaigns,以下是根据文档这里

I am working on the facebook ads API (3.2) But I am getting some weird errors. I am trying to get the campaigns And following is the method I am using for this according to the documentation Here

public function getcampaigns() {
   $adaccount = new AdAccount('331*****10774');
   $campaigns = $adaccount->getCampaigns();
   print_r($campaigns);
}

但是我得到了错误

然后我用资源管理器和相同的access_token进行尝试,效果很好.

Then I try this with Explorer with the same access_token and it worked well.

我在access_token

$this->permissions = ['email', 'ads_management', 'pages_show_list', 'publish_pages', 'manage_pages', 'ads_read', 'business_management'];

推荐答案

您应在act_字符串前面加上

尝试一下:

   $adaccount = new AdAccount('act_331*****10774');

代替此:

   $adaccount = new AdAccount('331*****10774');

此外,如果您测试例子:

use FacebookAds\Object\AdAccount;
use FacebookAds\Api;
use FacebookAds\Logger\CurlLogger;

$id = 'act_XXXX';

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

$fields = array(
  'name',
  'objective',
);
$params = array(
  'effective_status' => array('ACTIVE','PAUSED'),
);
echo json_encode((new AdAccount($id))->getCampaigns(
  $fields,
  $params
)->getResponse()->getContent(), JSON_PRETTY_PRINT);

按预期工作

希望获得帮助

这篇关于Facebook ads API:ID为'*****************'的对象不存在,由于缺少权限而无法加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆