- Модуль: seo
- Путь к файлу: ~/bitrix/modules/seo/lib/analytics/services/accountfacebook.php
- Класс: BitrixSeoAnalyticsServicesAccountFacebook
- Вызов: AccountFacebook::updateAdCreative
protected function updateAdCreative($accountId, $adId, array $creative)
{
unset($creative['id']);
foreach($creative as $key => $value)
{
if(is_array($value))
{
$creative[$key] = Json::encode($value);
}
}
$response = $this->getRequest()->send([
'method' => 'POST',
'endpoint' => 'act_'.$accountId.'/adcreatives',
'fields' => $creative,
]);
if($response->isSuccess())
{
$data = $response->getData();
if(isset($data['id']))
{
$response = $this->getRequest()->send([
'method' => 'POST',
'enpoint' => $adId,
'fields' => ['creative' => $data['id']],
]);
}
else
{
$response->addError(new Error('Could not find id after Ad Creative add'));
}
}
return $response;
}