Bad argument type for built-in operation

524 views
Skip to first unread message

Vinayak Chakraborty

unread,
Oct 13, 2023, 4:40:46 AM10/13/23
to Google Ads API and AdWords API Forum
I am trying to create a structure snippet here client is the instance of GoogleAdsClient. Can you help me with updated code?

def create_snippet_asset(client, camp_data):
    try:
        # Define the constants
        CUSTOMER_ID = str(camp_data["customer_id"])
        AD_GROUP_ID = str(camp_data["ad_group_id"])

        # Get the AdGroupExtensionSettingService
        ad_group_extension_setting_service = client.get_service("AdGroupExtensionSettingService")

        # Create a structure snippet extension
        structure_snippet_extension = client.get_type("StructuredSnippetFeedItem")
        structure_snippet_extension.header = "Brands"
        # string_value = client.get_type("StringValue", version="v14")
        structure_snippet_extension.values.extend([
                "Nike",
                "Adidas",
                "Reebok"
            ])

        # Create an ad group extension setting operation
        ad_group_extension_setting_operation = client.get_type("AdGroupExtensionSettingOperation")
        ad_group_extension_setting = ad_group_extension_setting_operation.create
        ad_group_extension_setting.ad_group = ad_group_extension_setting_service.ad_group_path(
            CUSTOMER_ID, AD_GROUP_ID
        )
        ad_group_extension_setting.extension_type = client.enums.ExtensionTypeEnum.STRUCTURED_SNIPPET
        ad_group_extension_setting.extension_feed_items.append(structure_snippet_extension)

        # Add the ad group extension setting
        response = ad_group_extension_setting_service.mutate_ad_group_extension_settings(
            customer_id=CUSTOMER_ID, operations=[ad_group_extension_setting_operation]
        )

        # Print the result
        print(f"Created a structure snippet extension with resource name: {response.results[0].resource_name}")

    except Exception as e:
        print(f'Error occured while creating structure snippet {e}')

Google Ads API Forum Advisor

unread,
Oct 16, 2023, 7:59:17 AM10/16/23
to vinayak.c...@prepbytes.com, adwor...@googlegroups.com
Hi,

Thank you for reaching out to the Google Ads API support team.

Can you further elaborate on what exact support you need from the Google Ads API support team?

I would recommend you refer to the "Client Libraries" documentation for more information.

 
This message is in relation to case "ref:!00D1U01174p.!5004Q02pRLb8:ref"

Thanks,
 
Google Logo Google Ads API Team

 

Vinayak Chakraborty

unread,
Oct 18, 2023, 2:59:32 AM10/18/23
to Google Ads API and AdWords API Forum
But there is nothing there, can you confirm that are callouts and structure snippets possible to automate via python?

Google Ads API Forum Advisor

unread,
Oct 19, 2023, 9:45:06 AM10/19/23
to vinayak.c...@prepbytes.com, adwor...@googlegroups.com
Hi,

Thank you for getting back to us.

Please note that we can only assist with technical queries/concerns related to the Google Ads API. For the Python Client library build issues, I would suggest you to post your query on Google Ads Python Github issue tracker as they are more equipped to provide guidance on this matter.
Reply all
Reply to author
Forward
0 new messages