Hello, I am trying to update AdGroupAd using Google API with python and provided google ads api library. But I am getting Immutable field error.
The ad type is ResponsiveSearchAd so it should be mutable as described here: https://developers.google.com/google-ads/api/docs/ads/ad-types#description_of_each_ad_type I found this old example where the ad group ad fields are updated but i does not work. https://developers.google.com/google-ads/api/samples/update-responsive-search-ad Here are the code, request and response examples: *Code:* googleads_service = self.google_ads_client.get_service("AdGroupAdService") operation = self.google_ads_client.get_type("AdGroupAdOperation") ad_group_ad = operation.update ad_group_ad.resource_name = ad_group_ad_resource_name headlines = [] for headline_param in headline_params: headline = self.google_ads_client.get_type("AdTextAsset") headline.text = self.safe_transform_headline(headline_param) if len(headlines) < 3 and len(headlines) < fixed_headlines_count: headline.pinned_field = getattr( self.google_ads_client.enums.ServedAssetFieldTypeEnum, f"HEADLINE_{len(headlines) + 1}", ) headlines.append(headline) ad_group_ad.ad.responsive_search_ad.headlines.extend(headlines) descriptions = [] for description_param in set(description_params): description = self.google_ads_client.get_type("AdTextAsset") description.text = description_param descriptions.append(description) ad_group_ad.ad.responsive_search_ad.descriptions.extend(descriptions) ad_group_ad.ad.final_urls.append(url) self.google_ads_client.copy_from( operation.update_mask, protobuf_helpers.field_mask(None, ad_group_ad._pb) ) request = self.google_ads_client.get_type("MutateAdGroupAdsRequest") request.customer_id = self.customer_id request.operations = [operation] request.partial_failure = True response = self.safe_api_call( method=ad_group_ad_service.mutate_ad_group_ads, request=request, timeout=TIMEOUT_SECONDS, ) *Request:* customer_id: "<<customer_id>>" operations { update { resource_name: "customers/<<customer_id>>/adGroupAds/<<ad_group_id>>~<<ad_id>>" ad { responsive_search_ad { headlines { pinned_field: HEADLINE_1 text: "text_1" } headlines { pinned_field: HEADLINE_2 text: "text_2" } headlines { text: "text_3" } headlines { text: "text_4" } headlines { text: "text_5" } descriptions { text: "desc_1" } descriptions { text: "desc_2" } descriptions { text: "desc_3" } } final_urls: "url" } } update_mask { paths: "resource_name" paths: "ad.final_urls" paths: "ad.responsive_search_ad.headlines" paths: "ad.responsive_search_ad.descriptions" } } partial_failure: true *Response:* errors { error_code { request_error: IMMUTABLE_FIELD } message: "Field \'ad.final_urls\' cannot be modified by \'UPDATE\' operation." location { field_path_elements { field_name: "operations" index: 0 } field_path_elements { field_name: "update" } field_path_elements { field_name: "ad" } field_path_elements { field_name: "final_urls" } } } errors { error_code { request_error: IMMUTABLE_FIELD } message: "Field \'ad.responsive_search_ad.descriptions\' cannot be modified by \'UPDATE\' operation." location { field_path_elements { field_name: "operations" index: 0 } field_path_elements { field_name: "update" } field_path_elements { field_name: "ad" } field_path_elements { field_name: "responsive_search_ad" } field_path_elements { field_name: "descriptions" } } } errors { error_code { request_error: IMMUTABLE_FIELD } message: "Field \'ad.responsive_search_ad.headlines\' cannot be modified by \'UPDATE\' operation." location { field_path_elements { field_name: "operations" index: 0 } field_path_elements { field_name: "update" } field_path_elements { field_name: "ad" } field_path_elements { field_name: "responsive_search_ad" } field_path_elements { field_name: "headlines" } } } -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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 [email protected] To unsubscribe from this group, send email to [email protected] 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 "Google Ads API and AdWords API Forum" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/adwords-api/2de37ec7-a777-4316-b94f-130f83bca48cn%40googlegroups.com.
