我正在尝试使用Facebook Ads API制作广告。到目前为止,我已经创建了广告集,广告素材和广告系列。但是,当我使用以下代码制作广告时,我收到了Invalid Parameter exception
。我在以下代码中做了什么错误?
Fatal error: Uncaught exception 'FacebookAds\Http\Exception\AuthorizationException' with message 'Invalid parameter'
in /..../fbsdk/vendor/facebook/php-ads-sdk/src/FacebookAds/Http/Exception/RequestException.php:137
Stack trace:
#0 /...../fbsdk/vendor/facebook/php-ads-sdk/src/FacebookAds/Http/Client.php(216): FacebookAds\Http\Exception\RequestException::create(Array, 500)
#1 /..../fbsdk/vendor/facebook/php-ads-sdk/src/FacebookAds/Http/Request.php(282): FacebookAds\Http\Client->sendRequest(Object(FacebookAds\Http\Request))
#2 /..../fbsdk/vendor/facebook/php-ads-sdk/src/FacebookAds/Api.php(152): FacebookAds\Http\Request->execute()
#3 /..../fbsdk/vendor/facebook/php-ads-sdk/src/FacebookAds/Api.php(194): FacebookAds\Api->executeRequest(Object(FacebookAds\Http\Request))
#4 /home1/d2 in /..../fbsdk/vendor/facebook/php-ads-sdk/src/FacebookAds/Http/Exception/RequestException.php on line 137
Your ads couldn't be created for the following reason: You must include the required field "adgroup_status"
我试过添加这个:
AdFields::STATUS => Ad::STATUS_PAUSED
or this
AdFields::ADGROUP_STATUS => AdGroup::STATUS_PAUSED,
但它不起作用。
$ad->setData(array(
AdFields::CREATIVE =>
array('creative_id' => $creative->id),
//AdFields::STATUS => Ad::STATUS_PAUSED, // try this but<-- this is ainvalid FB SDK 2.5.0
AdFields::NAME => 'My First Ad',
AdFields::ADSET_ID => $adset->id,
));
答案 0 :(得分:1)
此问题有错误报告:https://developers.facebook.com/bugs/434655563408601/
错误报告:
act_ID / ads的POST端点仍然期待着 “adgroup_status”参数,自API v2.5起应为“status”
来自Facebook的回复:
我们设法重现了这个问题,它似乎是有效的 错误。我们将此分配给相应的团队。
据我所知,目前无法使用v2.5 Ad SDK创建广告,因为adgroup_status参数是必需的,但同时已弃用。