Skip to content

Pushing an empty UrlList has no effect #63

Closed
@blubber

Description

@blubber

We are currently migrating our product to the new destination URLs and are hitting a snag. Setting finalUrls and finalMobilUrls on regular keywords works fine, but after setting URLs it is impossible to clear the list. This is the dictionary that we are passing to the mutate method:

{'operand': {'adGroupId': '<redacted>',
          'criterion': {'id': '<redacted>',
                        'matchType': u'EXACT',
                        'text': u'some keyword',
                        'xsi_type': 'Keyword'},
          'destinationUrl': '',
          'finalMobileUrls': {'urls': []},
          'finalUrls': {'urls': []},
          'xsi_type': 'BiddableAdGroupCriterion'},

'operator': 'SET'}

The following XML blob is created by suds:

<?xml version="1.0" ?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://adwords.google.com/api/adwords/cm/v201502" xmlns:tns="https://adwords.google.com/api/adwords/cm/v201502" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <SOAP-ENV:Header>
        <tns:RequestHeader>
            <tns:clientCustomerId>REDACTED</tns:clientCustomerId>
            <tns:developerToken>REDACTED</tns:developerToken>
            <tns:userAgent>(AwApi-Python, googleads/3.4.1, Python/2.7)</tns:userAgent>
            <tns:validateOnly>false</tns:validateOnly>
            <tns:partialFailure>false</tns:partialFailure>
        </tns:RequestHeader>
    </SOAP-ENV:Header>
    <ns0:Body>
        <ns1:mutate>
            <ns1:operations>
                <ns1:operator>SET</ns1:operator>
                <ns1:operand xsi:type="ns1:BiddableAdGroupCriterion">
                    <ns1:adGroupId>REDACTED</ns1:adGroupId>
                    <ns1:criterion xsi:type="ns1:Keyword">
                        <ns1:id>REDACTED</ns1:id>
                        <ns1:Criterion.Type>Keyword</ns1:Criterion.Type>
                        <ns1:text>some keyword</ns1:text>
                        <ns1:matchType>EXACT</ns1:matchType>
                    </ns1:criterion>
                    <ns1:AdGroupCriterion.Type>BiddableAdGroupCriterion</ns1:AdGroupCriterion.Type>
                    <ns1:destinationUrl/>
                </ns1:operand>
            </ns1:operations>
        </ns1:mutate>
    </ns0:Body>
</SOAP-ENV:Envelope>

In this XML blob the new (empty) UrlLists for finalUrls and finalMobileUrls are missing, and hence they are not cleared in AdWords. Setting the urls key to None or the finalUrls to {} or None doesn't solve the problem. It appears that either the adwords client or suds is removing the empty object.

Edit: this is using the latest versions of suds and googleads on Python 2.7.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions