Creating Image Ad

111 views
Skip to first unread message

Sreeprasad Govindankutty

unread,
Apr 5, 2016, 2:08:22 PM4/5/16
to AdWords API Forum
Hello Google Ads API team,

I have a question related to Image Ads.

I am creating an image ad using Google API.  I am using the reference id that is a read only provided by Google as the media Id. 

But when I try to create an image ad I am getting "RangeError.TOO_LOW" error on media id when media id < 0.

1. Is it wrong to use reference id as media id ?
2. Should I still abs value of reference id as media id ?
3. Can I generate a random number and use that as the media id  or is there a another way ? 

Could you please help me with this question

Yin Niu

unread,
Apr 5, 2016, 2:34:07 PM4/5/16
to AdWords API Forum
Hi, 

To create an imageAd, you'd need to upload the image first using MediaService, then use that media id to create an image Ad. I am not quite sure what reference id you are referring to and why it would give you a negative value. 

Thanks,
Yin, AdWords API Team. 

Sreeprasad Govindankutty

unread,
Apr 5, 2016, 2:41:56 PM4/5/16
to AdWords API Forum
Hi Yin,

Thanks for the quick response. 

I am creating an image ad using AdGroupAd's setAd method.  This accepts an ImageAd .
For the image ad, one the property is media Id.


The docs says that reference id is a Read Only media id key. I am setting the reference id as media id explicitly.

But now I get RangeError.TOO_LOW when media id < 0

Here is my SOAP error message :

<faultstring>[RangeError.TOO_LOW @ operations[2].operand.ad.image.mediaId.id]</faultstring>



Could you please help me fix this issue.

May I create a random number as media Id ? 
Is it wrong to use reference Id ?


Thank you
Sreeprasad

Yin Niu

unread,
Apr 5, 2016, 3:00:14 PM4/5/16
to AdWords API Forum
Hi Sreeprasad,

When you send the ImageAd object to the AdWords API, you can populate the image field and just specify the mediaId as returned by the MediaService.  Most of the rest of the fields including media reference id are readonly, and the name and imageData fields should only be sent to the MediaService, not with AdGroupAdService requests.

Sreeprasad Govindankutty

unread,
Apr 5, 2016, 3:34:46 PM4/5/16
to AdWords API Forum
Hi Yin,

 You are correct that I can use media service to populate the image field. But currently I am using 201509 library and not yet upgraded.
 Upgrading is in our road map but just not this sprint :) 

 Could you please tell me if there is another solution ? 

Thanks,
Sreeprasad

Yin Niu

unread,
Apr 5, 2016, 3:38:29 PM4/5/16
to AdWords API Forum
Hi Sreeprasad, 

MediaService is available in v210509. 
Reply all
Reply to author
Forward
0 new messages