Code Monkey home page Code Monkey logo

Comments (4)

 avatar commented on May 21, 2024

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 [email protected] 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}&adid={creative}&device={device}&retailer=delventosdoodles&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.

from googleads-java-lib.

 avatar commented on May 21, 2024

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

from googleads-java-lib.

jradcliff avatar jradcliff commented on May 21, 2024

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

from googleads-java-lib.

 avatar commented on May 21, 2024

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

from googleads-java-lib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.