Thank you for sharing this technique aitkul, I am able to copy an existing Template Ad that uses an Image from one campaign and copy it over to another different campaign using the same image as of v201502.
On Thursday, June 12, 2014 at 2:25:54 AM UTC-7, aitkul wrote: > > Hi Josh, thank you for the feedback. Yes, I already read in > https://developers.google.com/adwords/api/docs/reference/v201402/MediaService > that > these two options can be used with MediaService, it is however stated "for > example", so I thought MediaService can be used for all types of ads. > > I guess, I am left with no other option but to first upload the Image via > AdGroupAdService, and then copy it using TemplateAd#setOriginAdId() if I > want to reuse it. > > On Wednesday, June 11, 2014 8:08:10 PM UTC+2, Josh Radcliff (AdWords API > Team) wrote: > >> Hi, >> >> From what I've found so far, when creating a TemplateAd and providing an >> Image object, you must populated the Image.data >> <https://developers.google.com/adwords/api/docs/reference/v201402/MediaService.Image#data> >> attribute >> directly -- you cannot simply provide a media ID. >> >> The MediaService >> <https://developers.google.com/adwords/api/docs/reference/v201402/MediaService> >> >> is only meant for: >> >> - Upload new images for *location extensions*. >> - Get the IDs of *videos* you want to use in template ads. >> >> Cheers, >> Josh, AdWords API Team >> >> On Wednesday, June 11, 2014 7:18:46 AM UTC-4, aitkul wrote: >>> >>> Sorry, typed wrong code im my post, what I tried was actually this: >>> >>> *TemplateAd templateAd = new TemplateAd();* >>> *templateAd.setTemplateId(432L);* >>> *...* >>> >>> *Image image = new Image();image.setMediaId(**351043323* >>> *);templateAd.setAdAsImage(image);* >>> >>> On Tuesday, June 10, 2014 3:57:57 PM UTC+2, aitkul wrote: >>> >>>> Hi there, I was able to create an Image TemplateAd (templateId=432) by >>>> directly creating a new Image via >>>> com.google.api.ads.common.lib.utils.Media.getMediaDataFromFile. >>>> >>>> What I want to do now, is to reuse an Image I have previously uploaded >>>> via MediaService by its mediaId. >>>> >>>> When I do this: >>>> >>>> *TemplateAd templateAd = new TemplateAd();* >>>> *templateAd.setTemplateId(432L);* >>>> *...* >>>> >>>> >>>> *Image image = new >>>> Image();image.setMediaId(image.getMediaId());templateAd.setAdAsImage(newImage);* >>>> >>>> I get following request and error response. Could you please tell me >>>> why I get the error NullError.NULL_CONTENT? What am I doing wrong here? >>>> >>>> *Request:* >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> *<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope >>>> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/ >>>> <http://schemas.xmlsoap.org/soap/envelope/>" >>>> xmlns:xsd="http://www.w3.org/2001/XMLSchema >>>> <http://www.w3.org/2001/XMLSchema>" >>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance >>>> <http://www.w3.org/2001/XMLSchema-instance>"><soapenv:Header><ns1:RequestHeader >>>> >>>> xmlns:ns1="https://adwords.google.com/api/adwords/cm/v201402 >>>> <https://adwords.google.com/api/adwords/cm/v201402>" >>>> soapenv:mustUnderstand="0"><ns1:clientCustomerId>5329326840</ns1:clientCustomerId><ns1:developerToken>some_developer_token</ns1:developerToken><ns1:userAgent>some_agent</ns1:userAgent><ns1:validateOnly>false</ns1:validateOnly><ns1:partialFailure>false</ns1:partialFailure></ns1:RequestHeader></soapenv:Header><soapenv:Body><mutate >>>> >>>> xmlns="https://adwords.google.com/api/adwords/cm/v201402 >>>> <https://adwords.google.com/api/adwords/cm/v201402>"><operations><operator>ADD</operator><operand><adGroupId>14655479043</adGroupId><ad >>>> >>>> xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201402 >>>> <https://adwords.google.com/api/adwords/cm/v201402>" >>>> xsi:type="ns2:TemplateAd"><ns2:url>some_url</ns2:url><ns2:displayUrl>some_display_url</ns2:displayUrl><ns2:templateId>432</ns2:templateId><ns2:templateElements><ns2:uniqueName>adData</ns2:uniqueName><ns2:fields><ns2:name>appId</ns2:name><ns2:type>TEXT</ns2:type><ns2:fieldText>some_app_id_text</ns2:fieldText></ns2:fields><ns2:fields><ns2:name>appStore</ns2:name><ns2:type>ENUM</ns2:type><ns2:fieldText>2</ns2:fieldText></ns2:fields></ns2:templateElements><ns2:adAsImage><ns2:mediaId>351043323</ns2:mediaId></ns2:adAsImage><ns2:dimensions><ns2:width>300</ns2:width><ns2:height>250</ns2:height></ns2:dimensions><ns2:name>some_ad_name</ns2:name></ad><status>PAUSED</status></operand></operations></mutate></soapenv:Body></soapenv:Envelope>* >>>> >>>> Respone: >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> *<?xml version="1.0" encoding="UTF-8"?><soap:Envelope >>>> xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/ >>>> <http://schemas.xmlsoap.org/soap/envelope/>"><soap:Header><ResponseHeader >>>> xmlns="https://adwords.google.com/api/adwords/cm/v201402 >>>> <https://adwords.google.com/api/adwords/cm/v201402>"><requestId>0004fb7ba9c493000ae0ce41eb002b05</requestId><serviceName>AdGroupAdService</serviceName><methodName>mutate</methodName><operations>1</operations><responseTime>508</responseTime></ResponseHeader></soap:Header><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>[NullError.NULL_CONTENT >>>> >>>> @ >>>> operations[0].operand.ad.adAsImage]</faultstring><detail><ApiExceptionFault >>>> >>>> xmlns="https://adwords.google.com/api/adwords/cm/v201402 >>>> <https://adwords.google.com/api/adwords/cm/v201402>"><message>[NullError.NULL_CONTENT >>>> >>>> @ >>>> operations[0].operand.ad.adAsImage]</message><ApplicationException.Type>ApiException</ApplicationException.Type><errors >>>> >>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance >>>> <http://www.w3.org/2001/XMLSchema-instance>" >>>> xsi:type="NullError"><fieldPath>operations[0].operand.ad.adAsImage</fieldPath><trigger/><errorString>NullError.NULL_CONTENT</errorString><ApiError.Type>NullError</ApiError.Type><reason>NULL_CONTENT</reason></errors></ApiExceptionFault></detail></soap:Fault></soap:Body></soap:Envelope>* >>>> >>> -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ Also find us on our blog and Google+: https://googleadsdeveloper.blogspot.com/ https://plus.google.com/+GoogleAdsDevelopers/posts =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ You received this message because you are subscribed to the Google Groups "AdWords 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 Forum" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. Visit this group at http://groups.google.com/group/adwords-api. To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/d4676938-c93b-4bf1-a38d-03406d193d99%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
