Hello. I am trying to follow this tutorial <https://developers.google.com/google-ads/api/performance-max/listing-groups#python.> but with only two levels instead of three. I need to implement the same behavior that when you set the items to be included in an adgroup by selecting the custom labels.
# [START add_shopping_product_listing_group_tree] def create_listing_group(client, customer_id, ad_group_id, replace_existing_tree): """Adds a shopping listing group tree to a shopping ad group. Args: client: An initialized Google Ads client. customer_id: The Google Ads customer ID. ad_group_id: The ad group ID to which the node will be added. replace_existing_tree: Boolean, whether to replace the existing listing group tree on the ad group. Defaults to false. """ # Get the AdGroupCriterionService client. ad_group_criterion_service = client.get_service("AdGroupCriterionService") # Optional: Remove the existing listing group tree, if it already exists # on the ad group. The example will throw a LISTING_GROUP_ALREADY_EXISTS # error if a listing group tree already exists and this option is not # set to true. if replace_existing_tree: remove_listing_group_tree(client, customer_id, ad_group_id) # Create a list of ad group criteria operations. operations = [] # Construct the listing group tree "root" node. # Subdivision node: (Root node) ad_group_criterion_root_operation = create_listing_group_subdivision( client, customer_id, ad_group_id ) # Get the resource name that will be used for the root node. # This resource has not been created yet and will include the temporary # ID as part of the criterion ID. ad_group_criterion_root_resource_name = ( ad_group_criterion_root_operation.create.resource_name ) operations.append(ad_group_criterion_root_operation) # Construct the listing group unit nodes for NEW, USED, and other. condition_dimension_info = client.get_type("ListingDimensionInfo") enum = client.enums.ListingGroupFilterCustomAttributeIndexEnum pca_1 = client.get_type("ProductCustomAttributeInfo") pca_1.index = enum.INDEX1 pca_1.value = "test1" pca_2 = client.get_type("ProductCustomAttributeInfo") pca_2.index = enum.INDEX2 pca_2.value = "test2" condition_dimension_info.product_custom_attribute.CopyFrom(pca_1) operations.append( create_listing_group_unit_biddable( client, customer_id, ad_group_id, ad_group_criterion_root_resource_name, condition_dimension_info, 200_000, ) ) condition_dimension_info.product_custom_attribute.CopyFrom(pca_2) operations.append( create_listing_group_unit_biddable( client, customer_id, ad_group_id, ad_group_criterion_root_resource_name, condition_dimension_info, 200_000, ) ) client.copy_from( condition_dimension_info.product_custom_attribute, client.get_type("ProductCustomAttributeInfo"), ) operations.append( create_listing_group_unit_biddable( client, customer_id, ad_group_id, ad_group_criterion_root_resource_name, condition_dimension_info, 100_000 ) ) # Add the ad group criteria. mutate_ad_group_criteria_response = ( ad_group_criterion_service.mutate_ad_group_criteria( customer_id=customer_id, operations=operations ) ) # Print the results of the successful mutates. print( "Added ad group criteria for the listing group tree with the " "following resource names:" ) for result in mutate_ad_group_criteria_response.results: print(f"\t{result.resource_name}") print(f"{len(mutate_ad_group_criteria_response.results)} criteria added.") # [END add_shopping_product_listing_group_tree] But im getting this error: Removing existing listing group tree... Request made: ClientCustomerId: 5669844605, Host: googleads.googleapis.com, Method: /google.ads.googleads.v17.services.GoogleAdsService/Search, RequestId: n_bduMEd_NDTUZFejLuhtQ, IsFault: False, FaultMessage: None Request ------- Method: /google.ads.googleads.v17.services.AdGroupCriterionService/MutateAdGroupCriteria Host: googleads.googleapis.com Headers: { "developer-token": "REDACTED", "login-customer-id": "6892170814", "x-goog-api-client": "gl-python/3.10.14 grpc/1.66.1 gax/2.19.2 gccl/25.0.0 pb/5.28.1", "x-goog-request-params": "customer_id=5669844605" } Request: customer_id: "5669844605" operations { create { resource_name: "customers/5669844605/adGroupCriteria/167214635199~-1" status: ENABLED listing_group { type_: SUBDIVISION } } } operations { create { status: ENABLED listing_group { type_: UNIT case_value { product_custom_attribute { index: 3 value: "test1" } } parent_ad_group_criterion: "customers/5669844605/adGroupCriteria/167214635199~-1" } ad_group: "customers/5669844605/adGroups/167214635199" cpc_bid_micros: 200000 } } operations { create { status: ENABLED listing_group { type_: UNIT case_value { product_custom_attribute { index: 4 value: "test2" } } parent_ad_group_criterion: "customers/5669844605/adGroupCriteria/167214635199~-1" } ad_group: "customers/5669844605/adGroups/167214635199" cpc_bid_micros: 200000 } } operations { create { status: ENABLED listing_group { type_: UNIT case_value { product_custom_attribute { } } parent_ad_group_criterion: "customers/5669844605/adGroupCriteria/167214635199~-1" } ad_group: "customers/5669844605/adGroups/167214635199" cpc_bid_micros: 100000 } } Response ------- Headers: { "google.ads.googleads.v17.errors.googleadsfailure-bin": "\n~\n\u0003\u0002l\u00125Subdivided listing groups must have an \"others\" case.\u001a\u000b\u0010\u0001\"3\u0012\u000e\n\noperations\u0018\u0000\u0012\b\n\u0006create\u0012\u000f\n\rlisting_group\u0012\u0006\n\u0004type\n\u0001\n\u0002\b\u0012\u0012MEnum value 'UNKNOWN_ENUM_VALUE_ProductCustomAttributeIndex_3' cannot be used.\"^\u0012\u000e\n\noperations\u0018\u0001\u0012\b\n\u0006create\u0012\u000f\n\rlisting_group\u0012\f\n\ncase_value\u0012\u001a\n\u0018product_custom_attribute\u0012\u0007\n\u0005index\n\u0001\n\u0002\b\u0012\u0012MEnum value 'UNKNOWN_ENUM_VALUE_ProductCustomAttributeIndex_4' cannot be used.\"^\u0012\u000e\n\noperations\u0018\u0002\u0012\b\n\u0006create\u0012\u000f\n\rlisting_group\u0012\f\n\ncase_value\u0012\u001a\n\u0018product_custom_attribute\u0012\u0007\n\u0005index\n\u0001\n\u0003\u0003\u0002\u0012#The required field was not present.\"^\u0012\u000e\n\noperations\u0018\u0003\u0012\b\n\u0006create\u0012\u000f\n\rlisting_group\u0012\f\n\ncase_value\u0012\u001a\n\u0018product_custom_attribute\u0012\u0007\n\u0005index\u0012\u0016Byq_X3ku-ucrT5tu2e0xOg", "grpc-status-details-bin": "\b\u0003\u0012%Request contains an invalid argument.\u001a\u0005\nDtype.googleapis.com/google.ads.googleads.v17.errors.GoogleAdsFailure\u0012\u0005\n~\n\u0003\u0002l\u00125Subdivided listing groups must have an \"others\" case.\u001a\u000b\u0010\u0001\"3\u0012\u000e\n\noperations\u0018\u0000\u0012\b\n\u0006create\u0012\u000f\n\rlisting_group\u0012\u0006\n\u0004type\n\u0001\n\u0002\b\u0012\u0012MEnum value 'UNKNOWN_ENUM_VALUE_ProductCustomAttributeIndex_3' cannot be used.\"^\u0012\u000e\n\noperations\u0018\u0001\u0012\b\n\u0006create\u0012\u000f\n\rlisting_group\u0012\f\n\ncase_value\u0012\u001a\n\u0018product_custom_attribute\u0012\u0007\n\u0005index\n\u0001\n\u0002\b\u0012\u0012MEnum value 'UNKNOWN_ENUM_VALUE_ProductCustomAttributeIndex_4' cannot be used.\"^\u0012\u000e\n\noperations\u0018\u0002\u0012\b\n\u0006create\u0012\u000f\n\rlisting_group\u0012\f\n\ncase_value\u0012\u001a\n\u0018product_custom_attribute\u0012\u0007\n\u0005index\n\u0001\n\u0003\u0003\u0002\u0012#The required field was not present.\"^\u0012\u000e\n\noperations\u0018\u0003\u0012\b\n\u0006create\u0012\u000f\n\rlisting_group\u0012\f\n\ncase_value\u0012\u001a\n\u0018product_custom_attribute\u0012\u0007\n\u0005index\u0012\u0016Byq_X3ku-ucrT5tu2e0xOg", "request-id": "Byq_X3ku-ucrT5tu2e0xOg" } Fault: errors { error_code { criterion_error: LISTING_GROUP_SUBDIVISION_REQUIRES_OTHERS_CASE } message: "Subdivided listing groups must have an \"others\" case." trigger { int64_value: -1 } location { field_path_elements { field_name: "operations" index: 0 } field_path_elements { field_name: "create" } field_path_elements { field_name: "listing_group" } field_path_elements { field_name: "type" } } } errors { error_code { request_error: INVALID_ENUM_VALUE } message: "Enum value \'UNKNOWN_ENUM_VALUE_ProductCustomAttributeIndex_3\' cannot be used." location { field_path_elements { field_name: "operations" index: 1 } field_path_elements { field_name: "create" } field_path_elements { field_name: "listing_group" } field_path_elements { field_name: "case_value" } field_path_elements { field_name: "product_custom_attribute" } field_path_elements { field_name: "index" } } } errors { error_code { request_error: INVALID_ENUM_VALUE } message: "Enum value \'UNKNOWN_ENUM_VALUE_ProductCustomAttributeIndex_4\' cannot be used." location { field_path_elements { field_name: "operations" index: 2 } field_path_elements { field_name: "create" } field_path_elements { field_name: "listing_group" } field_path_elements { field_name: "case_value" } field_path_elements { field_name: "product_custom_attribute" } field_path_elements { field_name: "index" } } } errors { error_code { field_error: REQUIRED } message: "The required field was not present." location { field_path_elements { field_name: "operations" index: 3 } field_path_elements { field_name: "create" } field_path_elements { field_name: "listing_group" } field_path_elements { field_name: "case_value" } field_path_elements { field_name: "product_custom_attribute" } field_path_elements { field_name: "index" } } } request_id: "Byq_X3ku-ucrT5tu2e0xOg" Request made: ClientCustomerId: 5669844605, Host: googleads.googleapis.com, Method: /google.ads.googleads.v17.services.AdGroupCriterionService/MutateAdGroupCriteria, RequestId: Byq_X3ku-ucrT5tu2e0xOg, IsFault: True, FaultMessage: Subdivided listing groups must have an "others" case. That there are fields, that im not sending, that it is missing the others. -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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 adwords-api@googlegroups.com To unsubscribe from this group, send email to adwords-api+unsubscr...@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 "Google Ads API and AdWords API Forum" group. To unsubscribe from this group and stop receiving emails from it, send an email to adwords-api+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/e9d58eeb-4ccd-419a-bb41-fec9603f3fc5n%40googlegroups.com.