To make it clear, I want to create a CallOnlyAd object. Here is my sample code for reference (Python)
# Create the ad group ad.
ad_group_ad_operation = client.get_type("AdGroupAdOperation", version="v5")
ad_group_ad = ad_group_ad_operation.create
ad_group_ad.status = client.get_type("AdGroupAdStatusEnum", version="v5").PAUSED
ad_group_ad.ad_group = ad_group_service.ad_group_path(customer_id, row['Ad group ID'])
# Set call ad info.
ad_group_ad.ad.final_urls.append(url_to_use) #Commenting out this line causes the ad to be added with no issue.
ad_group_ad.ad.call_only_ad.country_code = "US"
ad_group_ad.ad.display_url = url_to_use
ad_group_ad.ad.call_only_ad.headline1 = h1
ad_group_ad.ad.call_only_ad.headline2 = h2
ad_group_ad.ad.call_only_ad.description1 = d1
ad_group_ad.ad.call_only_ad.description2 = d2
#ad_group_ad.ad.expanded_text_ad.path1 = path1
ad_group_ad.ad.call_only_ad.call_tracked = True
ad_group_ad.ad.call_only_ad.phone_number = phone_number
ad_group_ad.ad.call_only_ad.business_name = business
print(ad_group_ad)
adgroup_operations.append(ad_group_ad_operation)
...
...
try:
ad_group_ad_response = ad_group_ad_service.mutate_ad_group_ads(
customer_id, adgroup_operations
)
except GoogleAdsException as ex:
print(
f'Request with ID "{ex.request_id}" failed with status '
f'"{ex.error.code().name}" and includes the following errors:'
)
for error in ex.failure.errors:
print(f'\tError with message "{error.message}".')
if error.location:
for field_path_element in error.location.field_path_elements:
print(f"\t\tOn field: {field_path_element.field_name}")
sys.exit(1)