Removing campaign via api gives error missing operations[0].operand.settings[0].languageCode & operations[0].operand.settings[0].domainName

36 views
Skip to first unread message

Kain

unread,
May 22, 2018, 5:31:54 PM5/22/18
to AdWords API and Google Ads API Forum
I want to remove campaign via api (meaning SET campaign status to REMOVED according to google api https://developers.google.com/adwords/api/docs/samples/php/basic-operations#remove-a-campaign)
The issue is that it asks me for the languageCode and domainName (which are dynamic search ads fields), why removing a campaign needs these two fields? And I don't think my campaign is a dynamic search ad campaign.
It succeeded if I set campaign status to PAUSED or ENABLED, only REMOVED does not work.
Please help! thank you!


The soap request looks like:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

    <soapenv:Header>

        <ns1:RequestHeader xmlns:ns1="https://adwords.google.com/api/adwords/cm/v201710" soapenv:mustUnderstand="0">

            <ns1:clientCustomerId>123-345-1008</ns1:clientCustomerId>

            <ns1:developerToken>REDACTED</ns1:developerToken>

            <ns1:userAgent>xxx (AwApi-Java, AdWords-Axis/3.10.0, Common-Java/3.10.0, Axis/1.4, Java/1.8.0_91, maven)</ns1:userAgent>

            <ns1:validateOnly>false</ns1:validateOnly>

            <ns1:partialFailure>false</ns1:partialFailure>

        </ns1:RequestHeader>

    </soapenv:Header>

    <soapenv:Body>

        <mutate xmlns="https://adwords.google.com/api/adwords/cm/v201710">

            <operations>

                <operator>SET</operator>

                <operand>

                    <id>1408927584</id>

                    <name>campaginBudget1</name>

                    <status>REMOVED</status>

                    <servingStatus>SERVING</servingStatus>

                    <startDate>20180518</startDate>

                    <endDate>20371230</endDate>

                    <budget>

                        <budgetId>1464626154</budgetId>

                        <amount>

                            <microAmount>1230000</microAmount>

                        </amount>

                        <deliveryMethod>STANDARD</deliveryMethod>

                        <isExplicitlyShared>false</isExplicitlyShared>

                        <status>ENABLED</status>

                    </budget>

                    <frequencyCap/>

                    <settings xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201710" xsi:type="ns2:DynamicSearchAdsSetting"/>

                    <advertisingChannelType>SEARCH</advertisingChannelType>

                    <networkSetting>

                        <targetGoogleSearch>true</targetGoogleSearch>

                        <targetSearchNetwork>true</targetSearchNetwork>

                        <targetContentNetwork>true</targetContentNetwork>

                        <targetPartnerSearchNetwork>false</targetPartnerSearchNetwork>

                    </networkSetting>

                    <biddingStrategyConfiguration>

                        <biddingScheme xmlns:ns3="https://adwords.google.com/api/adwords/cm/v201710" xsi:type="ns3:ManualCpcBiddingScheme">

                            <ns3:enhancedCpcEnabled>false</ns3:enhancedCpcEnabled>

                        </biddingScheme>

                    </biddingStrategyConfiguration>

                </operand>

            </operations>

        </mutate>

    </soapenv:Body>

</soapenv:Envelope>



And the response looks like:

<?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/v201710">

            <requestId>00056cd075b736a10a62aa13bd094b12</requestId>

            <serviceName>CampaignService</serviceName>

            <methodName>mutate</methodName>

            <operations>1</operations>

            <responseTime>80</responseTime>

        </ResponseHeader>

    </soap:Header>

    <soap:Body>

        <soap:Fault>

            <faultcode>soap:Client</faultcode>

            <faultstring>[RequiredError.REQUIRED @ operations[0].operand.settings[0].domainName, RequiredError.REQUIRED @ operations[0].operand.settings[0].languageCode]</faultstring>

            <detail>

                <ApiExceptionFault xmlns="https://adwords.google.com/api/adwords/cm/v201710">

                    <message>[RequiredError.REQUIRED @ operations[0].operand.settings[0].domainName, RequiredError.REQUIRED @ operations[0].operand.settings[0].languageCode]</message>

                    <ApplicationException.Type>ApiException</ApplicationException.Type>

                    <errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="RequiredError">

                        <fieldPath>operations[0].operand.settings[0].domainName</fieldPath>

                        <fieldPathElements>

                            <field>operations</field>

                            <index>0</index>

                        </fieldPathElements>

                        <fieldPathElements>

                            <field>operand</field>

                        </fieldPathElements>

                        <fieldPathElements>

                            <field>settings</field>

                            <index>0</index>

                        </fieldPathElements>

                        <fieldPathElements>

                            <field>domainName</field>

                        </fieldPathElements>

                        <trigger/>

                        <errorString>RequiredError.REQUIRED</errorString>

                        <ApiError.Type>RequiredError</ApiError.Type>

                        <reason>REQUIRED</reason>

                    </errors>

                    <errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="RequiredError">

                        <fieldPath>operations[0].operand.settings[0].languageCode</fieldPath>

                        <fieldPathElements>

                            <field>operations</field>

                            <index>0</index>

                        </fieldPathElements>

                        <fieldPathElements>

                            <field>operand</field>

                        </fieldPathElements>

                        <fieldPathElements>

                            <field>settings</field>

                            <index>0</index>

                        </fieldPathElements>

                        <fieldPathElements>

                            <field>languageCode</field>

                        </fieldPathElements>

                        <trigger/>

                        <errorString>RequiredError.REQUIRED</errorString>

                        <ApiError.Type>RequiredError</ApiError.Type>

                        <reason>REQUIRED</reason>

                    </errors>

                </ApiExceptionFault>

            </detail>

        </soap:Fault>

    </soap:Body>

</soap:Envelope>

Luis Xander Talag (AdWords API Team)

unread,
May 23, 2018, 12:23:59 AM5/23/18
to AdWords API and Google Ads API Forum
Hi Kain,

Based on your SOAP logs, it seems like you are setting other fields while removing your campaign which may have caused the errorCould you try to just set the status to REMOVED and nothing else (see sample logs below) and see if it works?

    <soapenv:Body>
        <mutate xmlns="https://adwords.google.com/api/adwords/cm/v201710">
            <operations>
                <operator>SET</operator>
                <operand>
                    <id>YOUR_CAMPAIGN_ID</id>
                    <status>REMOVED</status>

                </operand>
            </operations>
        </mutate>
    </soapenv:Body>
</soapenv:Envelope>

If the issue persists after trying my suggestion, could you provide the complete SOAP request and response logs together with your real client customer ID and the campaign ID you are trying to remove so I could further investigate? Please reply via Reply privately to author.

Thanks and regards,
Luis
AdWords API Team
Reply all
Reply to author
Forward
0 new messages