why not CANT_UPDATE_NEGATIVE??

74 views
Skip to first unread message

Junghyun Park

unread,
May 3, 2017, 11:41:38 PM5/3/17
to AdWords API Forum
hi

i question !

why not update gender ?


java source code


        Gender male = new Gender();
        male.setId(10L);

        NegativeAdGroupCriterion genderNegativeAdGroupCriterion = new NegativeAdGroupCriterion();
        genderNegativeAdGroupCriterion.setAdGroupId(41418648415L);
        genderNegativeAdGroupCriterion.setCriterion(male);

        AdGroupCriterionOperation genderAdGroupCriterionOperation = new AdGroupCriterionOperation();
        genderAdGroupCriterionOperation.setOperand(genderNegativeAdGroupCriterion);
        genderAdGroupCriterionOperation.setOperator(Operator.SET);

        AdGroupCriterionReturnValue result = adGroupCriterionService.mutate(new AdGroupCriterionOperation[]{genderAdGroupCriterionOperation});

        // Display campaigns.
        for (AdGroupCriterion adGroupCriterion : result.getValue()) {
            System.out.printf("AdGroup criterion with adGroup ID %d, criterion ID %d, "
                            + "and type '%s' was added.%n", adGroupCriterion.getAdGroupId(),
                    adGroupCriterion.getCriterion().getId(),
                    adGroupCriterion.getCriterion().getCriterionType());
        }



==============

error message

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Header>
        <ResponseHeader xmlns="https://adwords.google.com/api/adwords/cm/v201702">
            <requestId>00054eaa7cc37f380a629c09ad097b5f</requestId>
            <serviceName>AdGroupCriterionService</serviceName>
            <methodName>mutate</methodName>
            <operations>1</operations>
            <responseTime>269</responseTime>
        </ResponseHeader>
    </soap:Header>
    <soap:Body>
        <soap:Fault>
            <faultcode>soap:Server</faultcode>
            <faultstring>[AdGroupCriterionError.CANT_UPDATE_NEGATIVE @ operations[0].operand]</faultstring>
            <detail>
                <ApiExceptionFault xmlns="https://adwords.google.com/api/adwords/cm/v201702">
                    <message>[AdGroupCriterionError.CANT_UPDATE_NEGATIVE @ operations[0].operand]</message>
                    <ApplicationException.Type>ApiException</ApplicationException.Type>
                    <errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="AdGroupCriterionError">
                        <fieldPath>operations[0].operand</fieldPath>
                        <fieldPathElements>
                            <field>operations</field>
                            <index>0</index>
                        </fieldPathElements>
                        <fieldPathElements>
                            <field>operand</field>
                        </fieldPathElements>
                        <trigger/>
                        <errorString>AdGroupCriterionError.CANT_UPDATE_NEGATIVE</errorString>
                        <ApiError.Type>AdGroupCriterionError</ApiError.Type>
                        <reason>CANT_UPDATE_NEGATIVE</reason>
                    </errors>
                </ApiExceptionFault>
            </detail>
        </soap:Fault>
    </soap:Body>
</soap:Envelope>



This field is required and should not be null when it is contained within Operators : SET, REMOVE.


why not update gender?

Ivan Bautista

unread,
May 4, 2017, 2:38:49 AM5/4/17
to AdWords API Forum
Hi Junghyun,

As per documentation, Negative ad group criteria can not be updated which is why the AdGroupCriterionError.CANT_UPDATE_NEGATIVE error was thrown. You may consider removing those Negative ad group criteria and add similar Negative criteria with updated information. 

Regards,
Ivan
AdWords API Team
Reply all
Reply to author
Forward
0 new messages