how to connect the ad to the label?

11 views
Skip to first unread message

Alexandr Zhorzh

unread,
Sep 4, 2018, 5:20:31 AM9/4/18
to AdWords API and Google Ads API Forum
Hi, i am fairly new with adwords API and can't find the missing example at the docs:

there is a way how to connect the campaign to the label, but there is no example about how to connect the ads to the label
i am using the python API

here is the campaign example, can you please point me at the right direction?

   36   campaign_service = client.GetService('CampaignService', version='v201806')
   37
   38   operations = [
   39     ¦ {
   40     ¦   ¦ 'operator': 'ADD',
   41     ¦   ¦ 'operand': {
   42     ¦   ¦   ¦ 'campaignId': campaign_id1,
   43     ¦   ¦   ¦ 'labelId': label_id,
   44     ¦   ¦ }
   45     ¦ },
   46     ¦ {
   47     ¦   ¦ 'operator': 'ADD',
   48     ¦   ¦ 'operand': {
   49     ¦   ¦   ¦ 'campaignId': campaign_id2,
   50     ¦   ¦   ¦ 'labelId': label_id,
   51     ¦   ¦ }
   52     ¦ }
   53   ]
   54
   55   result = campaign_service.mutateLabel(operations)

Milind Sankeshware (AdWords API Team)

unread,
Sep 4, 2018, 2:34:18 PM9/4/18
to AdWords API and Google Ads API Forum
Hi Alexandr,

To set the label to ad, you can use AdGroupAdService.mutatelabel API call. Please find the attached sample request and response log for AdGroupAdService. Please refer to code below:

 operations = [
      {
          'operator': 'ADD',
          'operand': {
              'adGroupId': adGroup_Id,
              'labelId': label_id,
              'adId' : ad_Id
          }
      }
   ]

Give a try and let me know if you are facing an issue. Also, please share the SOAP request and response. You can use 'Reply privately to author' option while responding. 

Thanks,
Milind, AdWords API Team
AddLabelToAd_log
Reply all
Reply to author
Forward
0 new messages