Update headlines in an asset group

92 views
Skip to first unread message

Gionni Lone

unread,
Jul 1, 2022, 4:08:01 AMJul 1
to Google Ads API and AdWords API Forum
Hi, I'm struggling to update headlines in an existing asset group, belonging to a perf max campaign. I need to replace those which have a "Low" performance label. I don't know if I should first delete the headlines I want to replace and then create the new ones. This is what I tried and the error:

googleads_service = self.get_service("GoogleAdsService")
asset_group_service = self.get_service("AssetGroupService")
headlines_resource_names = self._create_multiple_text_assets(account_id, asset_list)
asset_group_asset_operation = self.get_type("AssetGroupAssetOperation")
asset = asset_group_asset_operation.update
asset.resource_name = asset_group_service.asset_group_path(account_id, asset_group_id)
operations = []
for resource_name in headlines_resource_names:
         mutate_operation = self.get_type("MutateOperation")
         asset_group_asset = mutate_operation.asset_group_asset_operation.create 
         asset_group_asset.field_type =               self.get_type('AssetFieldTypeEnum').AssetFieldType.HEADLINE
         asset_group_asset.asset_group = asset.resource_name
         asset_group_asset.asset = resource_name
        operations.append(mutate_operation)

fm = protobuf_helpers.field_mask(None, asset._pb)
asset_group_asset_operation.update_mask.CopyFrom(fm)

for operation in operations:
         ad_group_ad_response = googleads_service.mutate(
         customer_id=str(account_id), mutate_operations=[operation]
)

And this is the error I received:

Method: /google.ads.googleads.v10.services.GoogleAdsService/Mutate
Host: googleads.googleapis.com
Headers: {
  "developer-token": "REDACTED",
  "login-customer-id": "4128782957",
  "x-goog-api-client": "gl-python/3.7.3 grpc/1.46.1 gax/2.7.1 gccl/16.0.0",
  "x-goog-request-params": "customer_id=1489840023"
}
Request: customer_id: "1489840023"
mutate_operations {
  asset_group_asset_operation {
    create {
      asset_group: "customers/1489840023/assetGroups/6442638580"
      asset: "customers/1489840023/assets/40299149686"
      field_type: HEADLINE
    }
  }
}


Response
-------
Headers: {
  "google.ads.googleads.v10.errors.googleadsfailure-bin": "\n\u0002\n\u0003\u0003\n\u0012\u0001This request would exceed a limit on the number of allowed resources. The details of which type of limit was exceeded will eventually be returned in ErrorDetails.\u001a.*,ENABLED_HEADLINE_ASSET_LINKS_PER_ASSET_GROUP\"6\u0012\u0015\n\u0011mutate_operations\u0018\u0000\u0012\u001d\n\u001basset_group_asset_operation*\u0014*\u0012\n\n6442638580\u0010\u0005\u0018\u0001 \u0005\u0012\u0016AMCFKOLBRmtNwl3g6rZaBA",
  "grpc-status-details-bin": "\b\u0003\u0012%Request contains an invalid argument.\u001a\u0003\nDtype.googleapis.com/google.ads.googleads.v10.errors.GoogleAdsFailure\u0012\u0002\n\u0002\n\u0003\u0003\n\u0012\u0001This request would exceed a limit on the number of allowed resources. The details of which type of limit was exceeded will eventually be returned in ErrorDetails.\u001a.*,ENABLED_HEADLINE_ASSET_LINKS_PER_ASSET_GROUP\"6\u0012\u0015\n\u0011mutate_operations\u0018\u0000\u0012\u001d\n\u001basset_group_asset_operation*\u0014*\u0012\n\n6442638580\u0010\u0005\u0018\u0001 \u0005\u0012\u0016AMCFKOLBRmtNwl3g6rZaBA",
  "request-id": "AMCFKOLBRmtNwl3g6rZaBA"
}
Fault: errors {
  error_code {
    resource_count_limit_exceeded_error: RESOURCE_LIMIT
  }
  message: "This request would exceed a limit on the number of allowed resources. The details of which type of limit was exceeded will eventually be returned in ErrorDetails."
  trigger {
    string_value: "ENABLED_HEADLINE_ASSET_LINKS_PER_ASSET_GROUP"
  }
  location {
    field_path_elements {
      field_name: "mutate_operations"
      index: 0
    }
    field_path_elements {
      field_name: "asset_group_asset_operation"
    }
  }
  details {
    resource_count_details {
      enclosing_id: "6442638580"
      limit: 5
      limit_type: UNKNOWN
      existing_count: 5
    }
  }
}
request_id: "AMCFKOLBRmtNwl3g6rZaBA"


WARNING:google.ads.googleads.client:Request made: ClientCustomerId: 1489840023, Host: googleads.googleapis.com, Method: /google.ads.googleads.v10.services.GoogleAdsService/Mutate, RequestId: AMCFKOLBRmtNwl3g6rZaBA, IsFault: True, FaultMessage: This request would exceed a limit on the number of allowed resources. The details of which type of limit was exceeded will eventually be returned in ErrorDetails.
Request with ID "AMCFKOLBRmtNwl3g6rZaBA" failed with status "INVALID_ARGUMENT" and includes the following errors:
        Error with message "This request would exceed a limit on the number of allowed resources. The details of which type of limit was exceeded will eventually be returned in ErrorDetails.".
                On field: mutate_operations
                On field: asset_group_asset_operation

Google Ads API Forum Advisor

unread,
Jul 1, 2022, 11:12:06 AMJul 1
to gilo...@gmail.com, adwor...@googlegroups.com
Hi Gionni,

Thank you for raising this concern to the Google Ads API Forum.

Upon checking the provided logs, I can see that you are encountering the headline limit for asset groups. According to this document, you can only add up to 5 headlines for the asset group. However, upon checking the counts of linked headlines to your asset group using the query below, I can see that you already exceeded the limit. This is the possible reason why the error persists. 

SELECT asset.id, asset_group_asset.status FROM asset_group_asset WHERE asset_group.resource_name = \"customers/1489840023/assetGroups/6442638580\" AND asset_group_asset.field_type ="HEADLINE"

Best regards,
Google Logo
Jinky
Google Ads API Team
 


ref:_00D1U1174p._5004Q2cFIxw:ref

Gionni Lone

unread,
Jul 4, 2022, 4:20:58 AMJul 4
to Google Ads API and AdWords API Forum
Hi, thank you for your reply. 
I know the maximum number I can have per asset is 5, but what I want to do is replacing them. With RSA when I wanted to replace them I would  just upload other 15 headlines and they get correctly replaced, but in this case it says "exceeded the limit". Can you please tell me whats the correct way of replacing those assets?

Thank you

Gionni Lone

unread,
Jul 4, 2022, 5:44:22 AMJul 4
to Google Ads API and AdWords API Forum
I also tried to update a single asset in this way, but received an error:

def update_asset_group_headlines(self, account_id, new_text, asset_resource_name):
       asset_group_service = self.get_service("AssetGroupAssetService")

       asset_group_asset_operation = self.get_type("AssetGroupAssetOperation")
       asset = asset_group_asset_operation.update
       asset.resource_name = asset_resource_name
       asset.asset = new_text
       asset.field_type = self.get_type('AssetFieldTypeEnum').AssetFieldType.HEADLINE


       fm = protobuf_helpers.field_mask(None, asset._pb)
       asset_group_asset_operation.update_mask.CopyFrom(fm)

       asset_group_service.mutate_asset_group_assets(
       customer_id=account_id, operations=[asset_group_asset_operation]
       )


Method: /google.ads.googleads.v10.services.AssetGroupAssetService/MutateAssetGroupAssets

Host: googleads.googleapis.com
Headers: {
  "developer-token": "REDACTED",
  "login-customer-id": "4128782957",
  "x-goog-api-client": "gl-python/3.7.3 grpc/1.46.1 gax/2.7.1 gccl/16.0.0",
  "x-goog-request-params": "customer_id=1489840023"
}
Request: customer_id: "1489840023"
operations {
  update {
    resource_name: "customers/1489840023/assetGroupAssets/6442638580~40330218621~HEADLINE"
    asset: "Eigen voorraad van Autohero"
    field_type: HEADLINE
  }
  update_mask {
    paths: "resource_name"
    paths: "asset"
    paths: "field_type"
  }
}


Response
-------
Headers: {
  "google.ads.googleads.v10.errors.googleadsfailure-bin": "\nb\n\u0002\b\u000b\u00127Field 'asset' cannot be modified by 'UPDATE' operation.\"#\u0012\u000e\n\noperations\u0018\u0000\u0012\b\n\u0006update\u0012\u0007\n\u0005asset\u0012\u00160ZvGNEeQOLJxdd6uSMhoPw",
  "grpc-status-details-bin": "\b\u0003\u0012%Request contains an invalid argument.\u001a\u0001\nDtype.googleapis.com/google.ads.googleads.v10.errors.GoogleAdsFailure\u0012|\nb\n\u0002\b\u000b\u00127Field 'asset' cannot be modified by 'UPDATE' operation.\"#\u0012\u000e\n\noperations\u0018\u0000\u0012\b\n\u0006update\u0012\u0007\n\u0005asset\u0012\u00160ZvGNEeQOLJxdd6uSMhoPw",
  "request-id": "0ZvGNEeQOLJxdd6uSMhoPw"
}
Fault: errors {
  error_code {
    request_error: IMMUTABLE_FIELD
  }
  message: "Field \'asset\' 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: "asset"
    }
  }
}
request_id: "0ZvGNEeQOLJxdd6uSMhoPw"

Google Ads API Forum Advisor

unread,
Jul 4, 2022, 6:31:45 AMJul 4
to gilo...@gmail.com, adwor...@googlegroups.com

Hi Gionni,

Thank you for the reply. Could you please provide more details where you exactly encounter the behavior below? I asked this because in the Google Ads API, once you have uploaded 5 enabled headlines, it is no longer possible to add more headlines because of the product level document that you provided.



"I know the maximum number I can have per asset is 5, but what I want to do is replacing them. With RSA when I wanted to replace them I would just upload other 15 headlines and they get correctly replaced, but in this case it says "exceeded the limit". Can you please tell me whats the correct way of replacing those assets?"

For the mutable error you encountered, the mutable field or field that you can update is the status in the object of AdGroupAsset.

Best regards,

Gionni Lone

unread,
Jul 4, 2022, 9:15:45 AMJul 4
to Google Ads API and AdWords API Forum
Hi,
I figured that in order to replace assets like headlines I need first to delete the headline I want to replace and then add the new one. That worked, thank you.

Google Ads API Forum Advisor

unread,
Jul 4, 2022, 11:09:01 AMJul 4
to gilo...@gmail.com, adwor...@googlegroups.com

Hi Gionni,

Thank you for the reply.

We're glad that you were able to find the information related to the behavior you observed. If you have additional questions regarding the topic being discussed in this thread, feel free to send those over to our team and we would be happy to assist you further.

Best regards,

Google Logo
Heidi
Google Ads API Team
 


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