Hi,

I'm trying to create an Image Ad inside an ad group. Here is my code (php):

        $adGroupAd = new AdGroupAd([
           'ad' => new Ad([
               'name' => $name,
               'final_urls' => $urls,
               'image_ad' => new ImageAdInfo([
                   'mime_type' => MimeType::IMAGE_PNG,
                   'pixel_width' => 200,
                   'pixel_height' => 200,
                   'image_url' => $pngImageUrl,
                   'preview_pixel_width' => 200,
                   'preview_pixel_height' => 200,
                   'preview_image_url' => $pngImageUrl,
                   'name' => $imageName,
                   'data' => file_get_contents($pngImageUrl),
               ])
           ]),
           'ad_group' => ResourceNames::forAdGroup($this->customerId, 
$adGroupId),
           'status' => AdGroupAdStatus::PAUSED
       ]);

I've attached the error as a separate file.

It seems to have to do with the 'data' attribute in the ImageAdInfo class, 
the error being adError: EMPTY_FIELD on the data attribute, reading: 'A 
required field was not specified or is an empty string.'.

I'm passing binary data (using file_get_contents()) as explained can be 
done here:
https://developers.google.com/google-ads/api/reference/rpc/v9/ImageAdInfo

But does not work. Any clue?

Thanks,
R

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
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 adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/7c58ce6e-5486-47fe-a106-033bed6a6d05n%40googlegroups.com.
  • Is... RS
    • ... 'Google Ads API Forum Advisor' via AdWords API and Google Ads API Forum
      • ... RS
        • ... 'Google Ads API Forum Advisor' via AdWords API and Google Ads API Forum
          • ... 'Google Ads API Forum Advisor' via AdWords API and Google Ads API Forum

Reply via email to