Add label to textAd

28 views
Skip to first unread message

jesus....@ogilvy.com

unread,
Nov 11, 2015, 11:43:47 AM11/11/15
to AdWords API Forum
Hi,

Im trying to add a label to a adGroup usnig this code

def AddLabel(AdIDs,LabelID):
    ad_group_ad_service = ADWORDS_CLIENT.GetService('AdGroupAdService', version='v201509')
    
    operations = []
    for AdID in AdIDs:
        operations += [{
            'operator': 'ADD',
            'operand': {
                'xsi_type': 'AdGroupAdLabel',
                'adGroupId': AdID['AdGroupID'],
                'adId':AdID['TextAdID'],
                'labelId': LabelID,
            }
        }]    
                
    ad_group_ad_service.mutate(operations)

but keep having this error:
suds.WebFault: Server raised fault: 'Unmarshalling Error: cvc-complex-type.2.4.a: Invalid content was found starting with element 'ns1:adId'. One of '{"https://adwords.google.com/api/adwords/cm/v201509":ad, "https://adwords.google.com/api/adwords/cm/v201509":experimentData, "https://adwords.google.com/api/adwords/cm/v201509":status, "https://adwords.google.com/api/adwords/cm/v201509":approvalStatus, "https://adwords.google.com/api/adwords/cm/v201509":trademarks, "https://adwords.google.com/api/adwords/cm/v201509":disapprovalReasons, "https://adwords.google.com/api/adwords/cm/v201509":trademarkDisapproved, "https://adwords.google.com/api/adwords/cm/v201509":labels, "https://adwords.google.com/api/adwords/cm/v201509":forwardCompatibilityMap}' is expected. '

Anyone know how to do this?

Thanks

Anthony Madrigal

unread,
Nov 11, 2015, 2:28:16 PM11/11/15
to AdWords API Forum
Hi,

In order to add a label to an ad, you will need to use the mutateLabel operation instead of the mutate operation. 

Please let me know if you are still facing issues.

Cheers,
Anthony
AdWords API Team
Reply all
Reply to author
Forward
0 new messages