Sorry, actually i found the fixes, since the imageAd class extends creative
class which has display URL getter setter. Now am stuck with upload image
process,
public function addImage(){
$session = self::setSession();
$adWordsServices = new AdWordsServices();
$assetService = $adWordsServices->get($session,
AssetService::class);
$adGroupAdService = $adWordsServices->get($session,
AdGroupAdService::class);
$adGroupId = '104834039189';
$ImageAd = new ImageAd();
$ImageAd->setName('ad imagesss');
$ImageAd->setDisplayUrl('https://mydisplayurl.com');
// Set a marketing image.
$marketingImageAsset = new imageAsset();
$marketingImageAsset->setAssetId(
self::uploadImageAsset($assetService,
'http://xxxx/Download/test_img.jpeg')
);
$ImageAd->setImage([
new AssetLink(
$marketingImageAsset
)]
);
// Create ad group ad.
$adGroupAd = new AdGroupAd();
$adGroupAd->setAdGroupId($adGroupId);
$adGroupAd->setAd($ImageAd);
// Create ad group ad operation and add it to the list.
$operation = new AdGroupAdOperation();
$operation->setOperand($adGroupAd);
$operation->setOperator(Operator::ADD);
// Add a responsive display ad on the server.
try{
$result = $adGroupAdService->mutate([$operation]);
$success = array('success');
return $success;
}catch (ApiException $apiException) {
return $apiException;
}
Issue:
[errorString:protected] => AdError.EMPTY_FIELD
[ApiErrorType:protected] => AdError
[parameterMap:Google\AdsApi\AdWords\v201809\cm\ApiError:private] => Array
( [ApiError.Type] => ApiErrorType
) ) [1] =>
Google\AdsApi\AdWords\v201809\cm\NullError Object (
[reason:protected] => NULL_CONTENT
[fieldPath:protected] => operations[0].operand.ad.image.data
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to the Google Groups
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/01d26a18-e9c7-4abc-8ad7-74f07fd849c8o%40googlegroups.com.