Unable to add Negative Keywords via Adwords API

26 views
Skip to first unread message

Bharani

unread,
Nov 5, 2018, 4:50:07 AM11/5/18
to AdWords API and Google Ads API Forum
I tried to add a negative Keywords using this example. I modified the placement to Keyword but then I get the following response.
[02 Nov 2018 11:21:52,962-requestInfoLogger:WARN:main] Request made: Service: CustomerNegativeCriterionService Method: mutate clientCustomerId: CLIENT ID URL: https://adwords.google.com/api/adwords/cm/v201806/CustomerNegativeCriterionService Request ID: null ResponseTime(ms): null OperationsCount: null IsFault: true FaultMessage: Unmarshalling Error: cvc-elt.4.2: Cannot resolve 'ns2:Keyword' to a type definition for element 'criterion'. 
[02 Nov 2018 11:21:52,980-soapXmlLogger:INFO:main] SOAP request:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <soapenv:Header>
        <ns1:RequestHeader xmlns:ns1="https://adwords.google.com/api/adwords/cm/v201806" soapenv:mustUnderstand="0">
            <ns1:clientCustomerId>CLIENT ID</ns1:clientCustomerId>
            <ns1:developerToken>REDACTED</ns1:developerToken>
            <ns1:userAgent>unknown (AwApi-Java, AdWords-Axis/3.15.0, Common-Java/3.15.0, Axis/1.4, Java/1.8.0_121, jars)</ns1:userAgent>
            <ns1:validateOnly>false</ns1:validateOnly>
            <ns1:partialFailure>false</ns1:partialFailure>
        </ns1:RequestHeader>
    </soapenv:Header>
    <soapenv:Body>
            <operations>
                <operator>ADD</operator>
                <operand>
                    <criterion xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201806" xsi:type="ns2:Keyword">
                        <ns2:text>SAMPLE Keyword</ns2:text>
                        <ns2:matchType>BROAD</ns2:matchType>
                    </criterion>
                </operand>
            </operations>
        </mutate>
    </soapenv:Body>
</soapenv:Envelope>

[02 Nov 2018 11:21:52,980-soapXmlLogger:INFO:main] SOAP response:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
        <soap:Fault>
            <faultcode>soap:Client</faultcode>
            <faultstring>Unmarshalling Error: cvc-elt.4.2: Cannot resolve 'ns2:Keyword' to a type definition for element 'criterion'. </faultstring>
        </soap:Fault>
    </soap:Body>
</soap:Envelope>

Request failed unexpectedly due to RemoteException: Unmarshalling Error: cvc-elt.4.2: Cannot resolve 'ns2:Keyword' to a type definition for element 'criterion'. 


What Am I missing here?

-
Bharani

Teja Makani

unread,
Nov 5, 2018, 11:41:38 AM11/5/18
to AdWords API and Google Ads API Forum
Hello Bharani,

Looks like you are trying to add negative keywords to the AdGroup. Instead you could use NegativeAdGroupCriterion on the AdGroupCriterion to add negative keywords to your AdGroups. You could also refer to the code sample AddKeywords.java. Please let me know if you have any further questions.

Regards,
Sai Teja, AdWords API Team.
Reply all
Reply to author
Forward
0 new messages