Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to submit empty urlList in SET request #45

Closed
ghost opened this issue May 12, 2015 · 4 comments
Closed

Unable to submit empty urlList in SET request #45

ghost opened this issue May 12, 2015 · 4 comments

Comments

@ghost
Copy link

ghost commented May 12, 2015

Hey guys -
I'm trying to set a tracking template and finalURL on a keyword. I explicitly set 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>
  <mutate xmlns="https://adwords.google.com/api/adwords/cm/v201502">
   <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>
      <urls>http://www.myhotel.com/chicago/promoCode={_promoCode}?kwid={_kwid}</urls>
     </finalUrls>
     <finalMobileUrls>
      <urls/>
     </finalMobileUrls>
     <trackingUrlTemplate>http://tracking.deepsearch.adlucent.com/adlucent/Redirector?kwid={_kwid}&amp;adid={creative}&amp;device={device}&amp;retailer=delventosdoodles&amp;url={lpurl}</trackingUrlTemplate>
     <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>

I then tried every variant I could come up with of setting the urlList to null, new UrlList(new String[]), & new UrlList(null), etc & regardless of what I tried, the soap message contains the same url chunk:

     <finalUrls>
        <urls/>
     </finalUrls>

& they all return UrlError.MISSING_PROTOCOL

Not surprisingly, it happens for both finalUrls and finalMobileUrls

-mm

@ghost
Copy link
Author

ghost commented May 12, 2015

Instead of setting null, you should set an empty list, like new UrlList(new
String[] {}), good luck!

On Tue, May 12, 2015 at 3:17 PM, mmATX notifications@github.com wrote:

Hey guys -
I'm trying to set a tracking template and finalURL on a keyword. I
explicitly set 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


SET

21999324732

142938960012



http://www.myhotel.com/chicago/promoCode={_promoCode}?kwid={_kwid}




http://tracking.deepsearch.adlucent.com/adlucent/Redirector?kwid={_kwid}&amp;adid={creative}&amp;device={device}&amp;retailer=delventosdoodles&amp;url={lpurl}


kwid
217ad6637be843f3810916685e2e82c7


promoCode
chi55893


season
Fall_getaway





/soapenv:Body

And the response:

soap:Header

000515869d2114280ab612c5320067a4
AdGroupCriterionService
mutate
1
101

/soap:Header
soap:Body


<ListReturnValue.Type>AdGroupCriterionReturnValue</ListReturnValue.Type>

<AdGroupCriterion.Type>AdGroupCriterion</AdGroupCriterion.Type>


operations[0].operand.finalMobileUrls.urls[0]

UrlError.MISSING_PROTOCOL
<ApiError.Type>UrlError</ApiError.Type>
MISSING_PROTOCOL



/soap:Body

I then tried every variant I could come up with of setting the urlList to
null, new UrlList(new String[]), & new UrlList(null), etc & regardless of
what I tried, the soap message contains the same url chunk:

 <finalUrls>
    <urls/>
 </finalUrls>

& they all return UrlError.MISSING_PROTOCOL

Not surprisingly, it happens for both finalUrls and finalMobileUrls

-mm


Reply to this email directly or view it on GitHub
#45.

@ghost
Copy link
Author

ghost commented May 12, 2015

Sorry, I wasn't clear enough. I have tried:

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

and out of desperation:

UrlList ul = new UrlList();
ul.setUrls(new String[0]);
bagc.setFinalMobileUrls(ul);
UrlList ul = new UrlList();
ul.setUrls(null);
bagc.setFinalMobileUrls(ul);

and receive UrlError.MISSING_PROTOCOL for all

@jradcliff
Copy link
Member

Hi,

I just verified that the following approach successfully clears finalMobileUrls for a keyword:

// Create ad group criterion with updated bid.
Criterion criterion = new Criterion();
criterion.setId(keywordId);

BiddableAdGroupCriterion biddableAdGroupCriterion = new BiddableAdGroupCriterion();
biddableAdGroupCriterion.setAdGroupId(adGroupId);
biddableAdGroupCriterion.setCriterion(criterion);

// Simply create a new UrlList. No need to set its urls.    
biddableAdGroupCriterion.setFinalMobileUrls(new UrlList());

This produced the following operations XML (which succeeded):

    <mutate xmlns="https://adwords.google.com/api/adwords/cm/v201502">
        <operations>
            <operator>SET</operator>
            <operand xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201502"
                    xsi:type="ns2:BiddableAdGroupCriterion">
                <adGroupId>19067540234</adGroupId>
                <criterion>
                    <id>10159180</id>
                </criterion>
                <finalMobileUrls/>
            </operand>
        </operations>
    </mutate>

Could you give that approach a try?

Thanks

@ghost
Copy link
Author

ghost commented May 12, 2015

Yes - that is giving me the right xml. Thanks a bunch!

@ghost ghost closed this as completed May 12, 2015
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant