OPERATOR_NOT_SUPPORTED when I trying to remove video id from adgroup (UniversalAppAd)

104 views
Skip to first unread message

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

unread,
Aug 13, 2019, 3:21:21 PM8/13/19
to AdWords API and Google Ads API Forum
I see you changed Adwords API. How I can remove and add video to adgroup for UniversalAppCampaign? Can you give me a code example of this on Python? Thank you!

I try to remove video from adgroup, but receiving this:

Error summary: {'faultMessage': '[OperatorError.OPERATOR_NOT_SUPPORTED @ operations[0]]', 'requestId': '00059004711962c10a379b91e10e93f3', 'serviceName': 'AdService', 'methodName': 'mutate', 'operations': '1', 'responseTime': '95'}
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 202, in <module>
    c.remove_media_ids()
  File "/Users/i.tirsky/PycharmProjects/googleadw/campaign_mutate.py", line 139, in remove_media_ids
    ads = self.ad_service.mutate(operations)['value']
  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]]

My code is:

operations = [{
'operator': 'REMOVE',
'operand': {
'id': 123, #ad id,
'xsi_type': 'UniversalAppAd',
'videos': [
{
'asset': {
'xsi_type': 'YouTubeVideoAsset',
'youTubeVideoId': 'xxxx', #youtube video id
},
},
],
},
}]

self.ad_service = client.GetService('AdService', version='v201809')

ads = self.ad_service.mutate(operations)

Google Ads API Forum Advisor Prod

unread,
Aug 14, 2019, 2:45:10 AM8/14/19
to adwor...@googlegroups.com
Hi,

Thank you for reaching out.

Upon checking your code, I can see that you are using the AdService. As per the link provided, this service can only support SET operator. This is the reason why you are encountering the error OPERATOR_NOT_SUPPORTED. You can use the AdGroupAdService.mutate() instead to remove the ad from the ad group instead. Unfortunately, we do not have an exact sample code on how to remove videos from Universal App Campaigns.

Regards,
Dannison
Google Ads API Team

ref:_00D1U1174p._5001UEIvKC:ref

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

unread,
Aug 14, 2019, 6:44:02 AM8/14/19
to AdWords API and Google Ads API Forum
operations = [{
'operator': 'REMOVE',
'operand': {
        'id': 328973xxxxxx, #this is an ad_id
        'xsi_type': 'UniversalAppAd',
'videos': [{
'asset': {
'xsi_type': 'YouTubeVideoAsset',
                'youTubeVideoId': 'Lvhv6xxxxx', #youtube video id

}
}]
}
}]

ad_service = client.GetService('AdGroupAdService', version='v201809')


And got an error:

Error summary: {'faultMessage': "Unmarshalling Error: cvc-elt.4.3: Type 'ns0:UniversalAppAd' is not validly derived from the type definition, 'AdGroupAd', of element 'ns0:operand'. ", 'serviceName': 'AdGroupAdService', 'methodName': 'mutate'}

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/googleads/common.py", line 992, 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: Unmarshalling Error: cvc-elt.4.3: Type 'ns0:UniversalAppAd' is not validly derived from the type definition, 'AdGroupAd', of element 'ns0:operand'.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/i.tirsky/PycharmProjects/googleadw/campaign_mutate.py", line 152, in <module>
    c.remove_media_ids()
  File "/Users/i.tirsky/PycharmProjects/googleadw/campaign_mutate.py", line 88, in remove_media_ids
    ads = ad_service.mutate(operations)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/googleads/common.py", line 1004, in MakeSoapRequest
    e.detail, errors=error_list, message=e.message)
googleads.errors.GoogleAdsServerFault: Unmarshalling Error: cvc-elt.4.3: Type 'ns0:UniversalAppAd' is not validly derived from the type definition, 'AdGroupAd', of element 'ns0:operand'.


среда, 14 августа 2019 г., 9:45:10 UTC+3 пользователь adsapiforumadvisor написал:

Google Ads API Forum Advisor Prod

unread,
Aug 15, 2019, 2:50:37 AM8/15/19
to adwor...@googlegroups.com
Hi,

My apologies for the confusion. I can see that you wish to remove the video itself from the ad. Could you, instead, try replacing the video instead of removing it using the AdService.mutate()?

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

unread,
Aug 15, 2019, 11:04:47 AM8/15/19
to AdWords API and Google Ads API Forum
Yes. I try to remove the video (or mediaId) from the campaign (but after changing API I can't remove mediaId from 
youtubeVideoMediaIds

list

I do not want to replace the video, I want to remove video from UAC campaign

My UAC campaign has this structure:

#     'id': 1693xxxxx,
# 'campaignGroupId': None,
# 'name': 'name',
# 'status': None,
# 'servingStatus': None,
# 'startDate': None,
# 'endDate': None,
# 'budget': None,
# 'conversionOptimizerEligibility': None,
# 'adServingOptimizationStatus': None,
# 'frequencyCap': None,
# 'settings': [
# {
# 'Setting.Type': 'GeoTargetTypeSetting',
# 'positiveGeoTargetType': 'DONT_CARE',
# 'negativeGeoTargetType': 'DONT_CARE'
# },
# {
# 'Setting.Type': 'UniversalAppCampaignSetting',
# 'appId': 'xxxxx',
# 'appVendor': 'xxxx',
# 'description1': 'xxxx',
# 'description2': 'xxxx',
# 'description3': 'xxxx',
# 'description4': 'xxxx',
# 'youtubeVideoMediaIds': [123,123,456],


And I want to remove 123, for example.

But I rewrote code with AdService.mutate()

operations = [{
'operator': 'SET',
'operand': {
'id': 1234,#ad_id,
        'xsi_type': 'UniversalAppAd',
'videos': [
{
'asset': {
'xsi_type': 'YouTubeVideoAsset',
                    'youTubeVideoId': 'Lvhv6xxxx',
'assetId': 123
},
},
],
},
}]


ad_service = client.GetService('AdService', version='v201809')
ad_service.mutate(operations)

And it required headlines and descriptions I added it:

googleads.errors.GoogleAdsServerFault: [CollectionSizeError.TOO_FEW @ operations[0].operand.headlines, CollectionSizeError.TOO_FEW @ operations[0].operand.descriptions]

Then I added headlines and descriptions:

'headlines': [{
"asset": {
"xsi_type": "TextAsset",
"assetId": 123,
"assetSubtype": "TEXT",
"Asset.Type": "TextAsset",
"assetText": "xxxx"
}}],
'descriptions': [{
"asset": {
"xsi_type": "TextAsset",
"assetId": 123,
"assetSubtype": "TEXT",
"Asset.Type": "TextAsset",
"assetText": "xxxx"
}}],

But after adding I've got this error

googleads.errors.GoogleAdsServerFault: [CollectionSizeError.TOO_FEW @ operations[0].operand.headlines, CollectionSizeError.TOO_FEW @ operations[0].operand.descriptions]

What I need to do, that to remove a video (mediaId) from UAC Campaign. Thanks!

четверг, 15 августа 2019 г., 9:50:37 UTC+3 пользователь adsapiforumadvisor написал:

Google Ads API Forum Advisor Prod

unread,
Aug 16, 2019, 1:22:33 PM8/16/19
to adwor...@googlegroups.com
Hello, instead of using the 'REMOVE' operator in your mutate request, please instead try using the 'SET' operator to update the ad itself. In doing so, specify what you would like the 'videos' array to look like after the operation is complete. So for example, if you had 1 video and wanted to remove it from the ad, you would specify an empty array. Keep in mind that although you are, in fact, removing the video from the ad, you are really just updating the details of the ad itself.

All the best,
Devin
The Google Ads API Team

ref:_00D1U1174p._5001UEIvKC:ref
Reply all
Reply to author
Forward
0 new messages