How to upload media assets to different UAC

122 views
Skip to first unread message

aditigs...@gmail.com

unread,
May 1, 2018, 11:01:10 AM5/1/18
to AdWords API and Google Ads API Forum
Hi,

I want to upload media (JPEG) files to different UACs. I have 2 different Universal Ad Campaigns currently running and I want to add a media asset to the one of the campaign with some id given.

What is the way to add the image based on the campaign id.

Thanks,
Aditi

Dhanya Sundararaju (AdWords API Team)

unread,
May 1, 2018, 3:51:48 PM5/1/18
to AdWords API and Google Ads API Forum
Hi Aditi,

You can set the media id on the UniversalAppCampaignSetting, and then pass the campaign id and the UniversalAppCampaignSetting on the Campaign object. A sample request is attached. Please let me know if you have further questions.

Regards,
Dhanya, AdWords API Team
SOAP_UAC_image.xml

aditigs...@gmail.com

unread,
May 1, 2018, 8:37:30 PM5/1/18
to AdWords API and Google Ads API Forum
Thanks Dhanya,

How should I assign it to the campaign Id?
I am doing this in python:

Get service in 'CampaignService' mode.

operations= [{
    'operator': 'ADD',
    'operand': {
      'id' : campaign_id,
      'settings':[
        {
    'xsi_type': 'UniversalAppCampaignSetting'
    'appId': appId,
        'appVendor': 'VENDOR_Google_market',
        'description1': ' Easy to user',
        'description2': 'On the go',
        'description3': 'Fun to play',
        'description4': ' Awesome Value',
        'imageMediaIds': [media_id]
           }
         ]
        }
      }]
response = service.mutate(operations)

It is throwing an error :
 googleads.errors.GoogleAdsServerFault: [StringLengthError.TOO_LONG @ operations[0].operand.settings[0].description4]


Thanks,
Aditi

Dhanya Sundararaju (AdWords API Team)

unread,
May 2, 2018, 12:55:20 PM5/2/18
to adwor...@googlegroups.com
Hi Aditi,

In python, to upload media to an existing campaign, you would use code snippet as below:

  campaign_service = client.GetService('CampaignService', version='v201802')
  # Construct operation and update campaign.
  operation = {
      'operator': 'SET',
      'operand': {
          'id': campaign_id,
          'settings': {
              'xsi_type': 'UniversalAppCampaignSetting',
              'imageMediaIds': [media_id]
          }
      }
  }

aditigs...@gmail.com

unread,
May 3, 2018, 11:25:58 PM5/3/18
to AdWords API and Google Ads API Forum
Thanks Dhanya! It works!! :)

Can you please let me know how to handle PolicyViolationError  while adding keywords

Dhanya Sundararaju (AdWords API Team)

unread,
May 4, 2018, 12:32:33 PM5/4/18
to AdWords API and Google Ads API Forum
Hi Aditi,

Via API, you will be able to submit policy exemption requests for those policy violations which has isExemptable as true. Please refer this section of guide for more details and code samples. If you have any further questions, could you please create a new post so that we will be able to track better?
Reply all
Reply to author
Forward
0 new messages