Facebook Graph API php cURL 请求 returns AdCreative 的部分数据,尽管有足够的权限(没有给出错误)

Facebook Graph API php cURL request returns partial data for AdCreative, despite sufficent permission (no error given)

我正在开发一个基于 PHP 的网络应用程序,供我机构的 3 名团队成员在内部使用,以读取活动和广告数据。 理想情况下,为了安全起见,该工具永远无法编辑广告。 我认为这是一个相对简单的工具。所以我选择了 cURL 请求,而不是使用 PHP Business SDK。

该应用程序处于 'In Development' 模式,正在由商务管理器中的系统用户访问,其令牌权限为:

系统用户已获得访问以下资产的权限:

The Ad Account. Permissions granted: View Performance
The Page. Permissions granted: View Page Performance

有了这些设置,应用程序就能够提取几乎所有需要的东西来查看我们 campaigns/ad sets/ads 所需的信息。我为此感到非常自豪。但只有一个问题。我似乎无法通过任何 API 请求获得任何广告的目的地 URL。

据我了解,我需要查询广告的AdCreative。

使用 php cURL 这样的请求:

$access_token = "REDACTED";
$app_secret = "REDACTED";
$appsecret_proof = hash_hmac('sha256', $access_token, $app_secret);
$handle = curl_init();

$url = "https://graph.facebook.com/v7.0/23845023771530707?fields=object_story_spec,thumbnail_url,link_url,call_to_action_type&access_token=$access_token&appsecret_proof=$appsecret_proof";


curl_setopt($handle, CURLOPT_URL, $url);
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec($handle);
curl_close($handle);

$result = json_decode($output,true);
echo "<pre>";print_r($result);echo "</pre>";

我得到以下 return:

Array
(
    [object_story_spec] => Array
        (
            [page_id] => 104422504276761
        )

    [thumbnail_url] => https://external.xx.fbcdn.net/safe_image.php?d=AQCP_C2YI....Shortened here for clarity of this post
    [id] => 23845023771530707
)

简而言之,似乎只填充了大约一半的字段。我真的需要获取广告的最终目的地 URL。我没有得到我请求的 link_url 或 call_to_action_type 字段。 :(

所以,我想知道诸如...

  1. 我做错了吗? AdCreative 查询此信息的方式是否错误?
  2. 我是否仍然缺少权限?
  3. 我无法获取这些字段是因为应用程序还在'In Development'吗?我需要提交应用程序以供审核吗?

抱歉,这里有几个问题合并为一个 post。

仅当广告在发布时创建了新的 page-post 时,创意对象中的字段 object_story_spec 才会出现。如果广告是参考现有 page-post.

创建的,则不会出现

幸运的是,对 created/referenced page-post effective_object_story_id 的引用应该存在于每个 ad-creative.

您可以通过 /{effective_object_story_id}?fields=... 查询 page-post 以查找本应存在于 object_story_spec 中的数据。

ad-creative: https://developers.facebook.com/docs/marketing-api/reference/ad-creative

page-post: https://developers.facebook.com/docs/graph-api/reference/page-post