Why I can't mutate youtubeVideoMediaIds list in UniversalAppCampaignSetting in CampaignService.CampaignOperation

25 views
Skip to first unread message

Игорь Тирский

unread,
Feb 13, 2019, 5:08:43 PM2/13/19
to AdWords API and Google Ads API Forum
Hello! I'm using CampaignService for updating of youtubeVideoMediaIds in my Campaign (UniversalAppCampaign)


And trying to use this:

from googleads import adwords
client = adwords.AdWordsClient.LoadFromStorage("googleads.yaml") # path to yaml file wherever it exists
campaign_service = client.GetService('CampaignService', version='v201809')
campaign_id = 000000
video_ids = [111111, 111112] # Input MediaId(s) here
def update_media_data(campaign_service, campaign_id, video_ids):
    operations = [{
        'operator': 'SET', #REMOVE using too, but this cause an error
        'operand': {
            'xsi_type': 'Campaign',
            'id': campaign_id,
            'settings': {
                'xsi_type': 'UniversalAppCampaignSetting',
                'youtubeVideoMediaIds': video_ids
                }
            }
    }]
return campaign_service.mutate(operations)

What I'm doing wrong? If I try to update video list with new videos using SET and
Why I can't use REMOVE to remove some video_ids from this list of
youtubeVideoMediaIds how to do it correct?

Thank you!

I have full list of youtube videos - 20 videos on Campaign. But I can't remove any videos with this API call...

def update_media_data(campaign_service, campaign_id, video_ids):
    operations = [{
        'operator': 'REMOVE' ###cause an error
        'operand': {
            'xsi_type': 'Campaign',
            'id': campaign_id,
            'settings': {
                'xsi_type': 'UniversalAppCampaignSetting',
                'youtubeVideoMediaIds': video_ids
                }
            }
    }]

Error summary: {'faultMessage': '[OperatorError.OPERATOR_NOT_SUPPORTED @ operations[0]]', 'requestId': '000581cb388671830ae9ee0f530ff774', 'serviceName': 'CampaignService', 'methodName': 'mutate', 'operations': '1', 'responseTime': '189'}
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/googleads/common.py", line 1382, in MakeSoapRequest
    *packed_args, _soapheaders=soap_headers)['body']['rval']
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/zeep/proxy.py", line 42, in __call__
    self._op_name, args, kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/zeep/wsdl/bindings/soap.py", line 132, in send
    return self.process_reply(client, operation_obj, response)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/zeep/wsdl/bindings/soap.py", line 194, in process_reply
    return self.process_error(doc, operation)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/zeep/wsdl/bindings/soap.py", line 299, in process_error
    detail=fault_node.find('detail'))
zeep.exceptions.Fault: [OperatorError.OPERATOR_NOT_SUPPORTED @ operations[0]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/i.tirsky/PycharmProjects/googleadw/campaign_mutate.py", line 78, in <module>
    res = camp.remove_media_ids()
  File "/Users/i.tirsky/PycharmProjects/googleadw/campaign_mutate.py", line 46, in remove_media_ids
    return self._update_media_data()
  File "/Users/i.tirsky/PycharmProjects/googleadw/campaign_mutate.py", line 67, in _update_media_data
    return self.campaign_service.mutate(operations)['value'][0]['settings'][1]['youtubeVideoMediaIds']
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/googleads/common.py", line 1394, in MakeSoapRequest
    e.detail, errors=error_list, message=e.message)
googleads.errors.GoogleAdsServerFault: [OperatorError.OPERATOR_NOT_SUPPORTED @ operations[0]]

Process finished with exit code 1


I think I can only update (add new video to list but not change the list) this list via SET command but cant REMOVE any videos(


googleadsapi...@google.com

unread,
Feb 14, 2019, 1:45:34 AM2/14/19
to AdWords API and Google Ads API Forum
Hi,

If you're going to mutate your youtubeVideoMediaIds, you should use the youtubeVideoMediaIdsOps instead and use the ListOperations to update the list of your youtubeVideoMediaIds. You may check this guide for more details about the ListOperations in UAC.

Thanks and regards,
Luis
AdWords API Team


=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    http://googleadsdeveloper.blogspot.com/search/label/adwords_api
    https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

Was your question answered? Please rate your experience with us by taking a short survey.
If not -- reply to this email and tell us what else we can do to help.

Take Survey

Also find us on our blog and discussion group:
http://googleadsdeveloper.blogspot.com/search/label/adwords_api
https://developers.google.com/adwords/api/community/

--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
 
You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwor...@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to the Google Groups "AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adwords-api+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/3280313b-e032-4ae8-89b0-042fc65bfe70%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages