Problems to upload image to App campaign via Ads API

472 views
Skip to first unread message

Renan Duarte Ribeiro dos Santos

unread,
Feb 4, 2020, 1:51:07 PM2/4/20
to AdWords API and Google Ads API Forum
Hi all,

For the past 3 weeks I have been trying to upload an image using Ads API but I'm constantly receiving the following error:

Request made: ClientCustomerId: 5497809701, Host: googleads.googleapis.com:443, Method: /google.ads.googleads.v2.services.AdService/MutateAds, RequestId: jksvO9WJsAfBiMQHZPHNqg, IsFault: True, FaultMessage: The error code is not in this version.

Request with ID "jksvO9WJsAfBiMQHZPHNqg" failed with status "INVALID_ARGUMENT" and includes the following errors:
	Error with message "The error code is not in this version.".
		On field: operations
		On field: update
		On field: app_ad
		On field: images
		On field: asset

However, I have been using the same code since last October and never faced this kind of error. Does anybody know if something changed in the API or in the endpoint?

Here is a snippet of my code:


                ##############################################
                #  Creating new image                #
                ##############################################                 
                
                # Media service
                media_file_service = client.get_service('MediaFileService', version='v2')
                
                # Media operation service
                media_file_operation = client.get_type('MediaFileOperation', version='v2')
                
                # Create IMAGE media file
                media_file_resource_name = create_image(client,customer_id,media_file_operation,image_id,media_file_service)
                
                ##############################################
                #  Creating new assets                       #
                ##############################################                 
                
                #Asset service
                asset_service = client.get_service('AssetService', version='v2')
                
                # Asset operation service
                asset_operation = client.get_type('AssetOperation', version='v2')
                
                # Mutate Image asset - Create
                asset_resource_name = mutate_image_create(client,customer_id,asset_operation,media_file_resource_name,asset_service,image_id)
                
                print('Uploading ....')
                print('Image: %s\n'%(asset_resource_name))


                ################################################
                #  Image Assets Update
                ################################################
#Including new video in the list of videos to be assigned to the ad group ad images_list.append(asset_resource_name)

                ##############################################
                #  Ad .                                      #
                ##############################################

                # Update Ad
                ad_operation = client.get_type('AdOperation', version='v2')
                ad = ad_operation.update
                ad.resource_name = ad_service.ad_path(customer_id, num_ad)
                
                for asset in images_list:
                    
                    print("Sending info to Google ads...")
                    
                    image_asset = ad.app_ad.images.add()
                    image_asset.asset.value = asset

                    #==============================================
                    # Field Mask Update
                    #==============================================

                    fm = protobuf_helpers.field_mask(None, ad)
                    ad_operation.update_mask.CopyFrom(fm)

Google Ads API Forum Advisor Prod

unread,
Feb 5, 2020, 3:34:24 PM2/5/20
to renan....@wildlifestudios.com, adwor...@googlegroups.com

Hello Renan,

Thank you for reaching out. Could you please confirm if you are trying to upload image assets via Google Ads API Beta? If yes, you could use the code sample provided here to upload the image via Google Ads API Beta. If you are having trouble implementing this on your end, could you please share the complete request and response logs along with the client customer id by enabling Python logging for me to investigate this further on my end and assist you better?

P.S. Please use Reply privately to author option while sharing the details.

Regards,
Nikisha Patel, Google Ads API Team



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