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 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 Forum" group. To unsubscribe from this group and stop receiving emails from it, send an email to adwords-api+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.