UrlError.MISSING_PROTOCOL when no url specified

200 views
Skip to first unread message

mm

unread,
May 7, 2015, 8:08:07 PM5/7/15
to adwor...@googlegroups.com
Hey guys -
I'm trying to set a tracking template and finalURL on a keyword. I am explicitly setting the finalMobileUrls to null, yet when I attempt the update, I get the UrlError.MISSING_PROTOCOL for the non-existent mobile url. This is using the v201502 java client (googleads-java-lib-v1.38.0, specifically).

The code:

Criterion keyword = new Criterion();
            keyword.setId( Long.parseLong( k.getId().getKeywordId() ) );

            BiddableAdGroupCriterion bagc = new BiddableAdGroupCriterion();
            bagc.setAdGroupId( Long.parseLong( k.getId().getAdGroupId()) );
            bagc.setCriterion( keyword );
            //If there used to be a destURL value, an empty string tells adwords to get rid of it
            bagc.setDestinationUrl("");
            bagc.setTrackingUrlTemplate(k.getTrackingTemplate()==null?"":k.getTrackingTemplate());
            if (k.getFinalURL()==null) {
            bagc.setFinalUrls(null);
            } else {
            bagc.setFinalUrls(new UrlList(new String[]{k.getFinalURL()}));
            }
            if (k.getFinalMobileURL()==null) {
            bagc.setFinalMobileUrls(null);
            } else {
            bagc.setFinalMobileUrls(new UrlList(new String[]{k.getFinalMobileURL()}));
            }

And the resulting soap request:

 <soapenv:Body>
   <operations>
    <operator>SET</operator>
    <operand xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201502" xsi:type="ns2:BiddableAdGroupCriterion">
     <adGroupId>21999324732</adGroupId>
     <criterion>
      <id>142938960012</id>
     </criterion>
     <destinationUrl/>
     <finalUrls>
     </finalUrls>
     <finalMobileUrls>
      <urls/>
     </finalMobileUrls>
     <urlCustomParameters>
      <parameters>
       <key>kwid</key>
       <value>217ad6637be843f3810916685e2e82c7</value>
      </parameters>
      <parameters>
       <key>promoCode</key>
       <value>chi55893</value>
      </parameters>
      <parameters>
       <key>season</key>
       <value>Fall_getaway</value>
      </parameters>
     </urlCustomParameters>
    </operand>
   </operations>
  </mutate>
 </soapenv:Body>

And the response:    
<soap:Header>
        <ResponseHeader xmlns="https://adwords.google.com/api/adwords/cm/v201502">
            <requestId>000515869d2114280ab612c5320067a4</requestId>
            <serviceName>AdGroupCriterionService</serviceName>
            <methodName>mutate</methodName>
            <operations>1</operations>
            <responseTime>101</responseTime>
        </ResponseHeader>
    </soap:Header>
    <soap:Body>
        <mutateResponse xmlns="https://adwords.google.com/api/adwords/cm/v201502">
            <rval>
                <ListReturnValue.Type>AdGroupCriterionReturnValue</ListReturnValue.Type>
                <value>
                    <AdGroupCriterion.Type>AdGroupCriterion</AdGroupCriterion.Type>
                </value>
                <partialFailureErrors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="UrlError">
                    <fieldPath>operations[0].operand.finalMobileUrls.urls[0]</fieldPath>
                    <trigger/>
                    <errorString>UrlError.MISSING_PROTOCOL</errorString>
                    <ApiError.Type>UrlError</ApiError.Type>
                    <reason>MISSING_PROTOCOL</reason>
                </partialFailureErrors>
            </rval>
        </mutateResponse>
    </soap:Body>

Is there some other way I should be indicating that there are no finalMobileUrls?

Thanks -
mm

Michael Cloonan (AdWords API Team)

unread,
May 8, 2015, 1:02:55 PM5/8/15
to adwor...@googlegroups.com, marg...@buyerpath.com
Hello,

I believe that you need a UrlList with no URLs, rather than setting to null directly.

Try changing this line:
bagc.setFinalMobileUrls(null);

To this:
bagc.setFinalMobileUrls(new UrlList(new String[]));

If this still fails, let me know and I can look into it further.

Regards,
Mike, AdWords API Team

mm

unread,
May 11, 2015, 11:02:23 AM5/11/15
to adwor...@googlegroups.com
Ah  -duh! - don't know why I didn't try that... Thanks, Michael!

mm

unread,
May 11, 2015, 6:50:43 PM5/11/15
to adwor...@googlegroups.com
Alas, that doesn't work, either, Michael. I tried every permutation I could come up with:
bagc.setFinalMobileUrls(null);

bagc.setFinalMobileUrls(new UrlList());

bagc.setFinalMobileUrls(new UrlList(null));

bagc.setFinalMobileUrls(new UrlList());
bagc.getFinalMobileUrls().setUrls(null);

bagc.setFinalMobileUrls(new UrlList(new String[]));


Regardless of which of these I tried, the soap message contains the same url chunk:
     <finalUrls>
        <urls/>
     </finalUrls>

so they all return UrlError.MISSING_PROTOCOL

And, not surprisingly, it happens for both finalUrls and finalMobileUrls

-mm

Michael Cloonan (AdWords API Team)

unread,
May 12, 2015, 9:40:10 AM5/12/15
to adwor...@googlegroups.com, marg...@buyerpath.com
Hello,

After a little testing with another client library, I believe the format the XML should take to "un-set" this field is:

<finalUrls/>

This may be a bug with the Java client library. Please file a bug at their issue tracker with details about what you've tried so far.

Regards,
Mike, AdWords API Team

mm

unread,
May 12, 2015, 7:40:33 PM5/12/15
to adwor...@googlegroups.com, marg...@buyerpath.com
Just to follow up, it turns out the correct usage is:

bagc.setFinalMobileUrls(new UrlList());
Reply all
Reply to author
Forward
0 new messages