Skip to content

Response includes output-only fields - Google Ads API v14 #489

@elishakutnick

Description

@elishakutnick

Describe the bug:
https://github.com/googleads/google-ads-ruby/blob/main/examples/advanced_operations/add_smart_campaign.rb was used as reference in our implementation, but we've been unable to successfully create a smart campaign. More specifically, we heard from the Google Ads API team that we are passing output-only fields in the request body (primary_status_reasons: [], serving_status::UNSPECIFIED, bidding_strategy_system_status::UNSPECIFIED). While you can see these fields in the response, these fields are not included in our implementation and we are curious if this is a bug specific to the version of the Ads API we are currently using.

Steps to Reproduce:
Create smart campaign

Expected behavior:
Successful creation of a smart campaign

Client library version and API version:
Client library version:
Google Ads API version: 14

Request/Response Logs:


[6] sb-pry [sellbrite:production] [tenant: 637174] [09 Apr 22:28] (main)> api.create_smart_campaign(campaign, channel.google_merchant_center_id) W, [2024-04-09T22:29:09.687486 #121290] WARN -- : CID: 4897329142, Host: googleads.googleapis.com:443, Method: /google.ads.googleads.v14.services.GoogleAdsService/Mutate, IsFault: yes, Request ID:HV47H4A1DkJpLg8uLbjy-A I, [2024-04-09T22:29:09.690741 #121290] INFO -- : Outgoing request: Headers: {"developer-token":"REDACTED","login-customer-id":"5910183174","x-goog-api-client":"gl-ruby/2.7.8 gccl/23.1.0 gax/0.21.1 gapic/23.1.0 grpc/1.61.0 pb/3.25.2","x-goog-request-params":"customer_id=4897329142"} 

Payload: <Google::ads::GoogleAds::V14::Services::MutateGoogleAdsRequest: customer_id: "4897329142", mutate_operations: [<Google::ads::GoogleAds::V14::Services::MutateOperation: campaign_budget_operation: <Google::ads::GoogleAds::V14::Services::CampaignBudgetOperation: create: <Google::ads::GoogleAds::V14::Resources::CampaignBudget: resource_name: "customers/4897329142/campaignBudgets/-1", name: "Test SSC", amount_micros: 15000000, status: :UNSPECIFIED, delivery_method: :UNSPECIFIED, period: :UNSPECIFIED, type: :SMART_CAMPAIGN, aligned_bidding_strategy_id: 0>>>, <Google::ads::GoogleAds::V14::Services::MutateOperation: campaign_operation: <Google::ads::GoogleAds::V14::Services::CampaignOperation: create: <Google::ads::GoogleAds::V14::Resources::Campaign: resource_name: "customers/4897329142/campaigns/-2", name: "Test SSC", primary_status: :UNSPECIFIED, primary_status_reasons: [], status: :ENABLED, serving_status: :UNSPECIFIED, bidding_strategy_system_status: :UNSPECIFIED, ad_serving_optimization_status: :UNSPECIFIED, advertising_channel_type: :SMART, advertising_channel_sub_type: :SMART_CAMPAIGN, url_custom_parameters: [], labels: [], experiment_type: :UNSPECIFIED, campaign_budget: "customers/4897329142/campaignBudgets/-1", bidding_strategy_type: :UNSPECIFIED, accessible_bidding_strategy: "", frequency_caps: [], video_brand_safety_suitability: :UNSPECIFIED, payment_mode: :UNSPECIFIED, excluded_parent_asset_field_types: [], excluded_parent_asset_set_types: []>>>, <Google::ads::GoogleAds::V14::Services::MutateOperation: smart_campaign_setting_operation: <Google::ads::GoogleAds::V14::Services::SmartCampaignSettingOperation: update: <Google::ads::GoogleAds::V14::Resources::SmartCampaignSetting: resource_name: "customers/4897329142/smartCampaignSettings/-2", campaign: "", phone_number: <Google::ads::GoogleAds::V14::Resources::SmartCampaignSetting::PhoneNumber: phone_number: "(602) 815-2760", country_code: "US">, advertising_language_code: "en", final_url: "https://a23349.p3187.c1.store.godaddywp.com/", business_name: "blank">, update_mask: <Google::Protobuf::FieldMask: paths: ["phone_number.phone_number", "phone_number.country_code", "advertising_language_code", "final_url", "business_name"]>>>, <Google::ads::GoogleAds::V14::Services::MutateOperation: campaign_criterion_operation: <Google::ads::GoogleAds::V14::Services::CampaignCriterionOperation: create: <Google::ads::GoogleAds::V14::Resources::CampaignCriterion: resource_name: "", campaign: "customers/4897329142/campaigns/-2", display_name: "", type: :UNSPECIFIED, status: :UNSPECIFIED>>>, <Google::ads::GoogleAds::V14::Services::MutateOperation: ad_group_operation: <Google::ads::GoogleAds::V14::Services::AdGroupOperation: create: <Google::ads::GoogleAds::V14::Resources::AdGroup: resource_name: "customers/4897329142/adGroups/-3", name: "Test SSC ad group #1712701749184", status: :UNSPECIFIED, type: :SMART_CAMPAIGN_ADS, ad_rotation_mode: :UNSPECIFIED, url_custom_parameters: [], campaign: "customers/4897329142/campaigns/-2", optimized_targeting_enabled: false, display_custom_bid_dimension: :UNSPECIFIED, effective_target_cpa_source: :UNSPECIFIED, effective_target_roas_source: :UNSPECIFIED, labels: [], excluded_parent_asset_field_types: [], excluded_parent_asset_set_types: []>>>, <Google::ads::GoogleAds::V14::Services::MutateOperation: ad_group_ad_operation: <Google::ads::GoogleAds::V14::Services::AdGroupAdOperation: create: <Google::ads::GoogleAds::V14::Resources::AdGroupAd: resource_name: "", status: :UNSPECIFIED, ad_group: "customers/4897329142/adGroups/-3", ad: <Google::ads::GoogleAds::V14::Resources::ad: resource_name: "", final_urls: [], final_app_urls: [], final_mobile_urls: [], url_custom_parameters: [], type: :SMART_CAMPAIGN_AD, device_preference: :UNSPECIFIED, url_collections: [], system_managed_resource_source: :UNSPECIFIED>, ad_strength: :UNSPECIFIED,action_items: [], labels: []>>>], partial_failure: false, validate_only: false, response_content_type: :UNSPECIFIED> I, [2024-04-09T22:29:09.690928 #121290] 

INFO -- : Incoming response (errors): Google::ads::GoogleAds::errors::GoogleAdsError(Google::ads::GoogleAds::errors::GoogleAdsError): The required field was not present.The field attempted to be mutated is immutable. called from: /home/sellbrite/app/lib/requests/google_ads_request_smart_campaign.rb:35:in `create_smart_campaign' Google::ads::GoogleAds::errors::GoogleAdsError: Google::ads::GoogleAds::errors::GoogleAdsError from /home/sellbrite/app/vendor/bundle/ruby/2.7.0/gems/google-ads-googleads-23.1.0/lib/google/ads/google_ads/interceptors/error_interceptor.rb:67:in `rescue in request_response' Caused by GRPC::InvalidArgument: 3:Request contains an invalid argument.. debug_error_string:{UNKNOWN:Error received from peer ipv4:142.251.163.95:443 {grpc_message:"Request contains an invalid argument.", grpc_status:3, created_time:"2024-04-09T22:29:09.686892344+00:00"}} from /home/sellbrite/app/vendor/bundle/ruby/2.7.0/gems/grpc-1.61.0-aarch64-linux/src/ruby/lib/grpc/generic/active_call.rb:29:in `check_status'[6] sb-pry [sellbrite:production] [tenant: 637174] [09 Apr 22:28] (main)> api.create_smart_campaign(campaign, channel.google_merchant_center_id) W, [2024-04-09T22:29:09.687486 #121290] WARN -- : CID: 4897329142, Host: googleads.googleapis.com:443, Method: /google.ads.googleads.v14.services.GoogleAdsService/Mutate, IsFault: yes, Request ID:HV47H4A1DkJpLg8uLbjy-A I, [2024-04-09T22:29:09.690741 #121290] INFO -- : Outgoing request: Headers: {"developer-token":"REDACTED","login-customer-id":"5910183174","x-goog-api-client":"gl-ruby/2.7.8 gccl/23.1.0 gax/0.21.1 gapic/23.1.0 grpc/1.61.0 pb/3.25.2","x-goog-request-params":"customer_id=4897329142"} Payload: <Google::ads::GoogleAds::V14::Services::MutateGoogleAdsRequest: customer_id: "4897329142", mutate_operations: [<Google::ads::GoogleAds::V14::Services::MutateOperation: campaign_budget_operation: <Google::ads::GoogleAds::V14::Services::CampaignBudgetOperation: create: <Google::ads::GoogleAds::V14::Resources::CampaignBudget: resource_name: "customers/4897329142/campaignBudgets/-1", name: "Test SSC", amount_micros: 15000000, status: :UNSPECIFIED, delivery_method: :UNSPECIFIED, period: :UNSPECIFIED, type: :SMART_CAMPAIGN, aligned_bidding_strategy_id: 0>>>, <Google::ads::GoogleAds::V14::Services::MutateOperation: campaign_operation: <Google::ads::GoogleAds::V14::Services::CampaignOperation: create: <Google::ads::GoogleAds::V14::Resources::Campaign: resource_name: "customers/4897329142/campaigns/-2", name: "Test SSC", primary_status: :UNSPECIFIED, primary_status_reasons: [], status: :ENABLED, serving_status: :UNSPECIFIED, bidding_strategy_system_status: :UNSPECIFIED, ad_serving_optimization_status: :UNSPECIFIED, advertising_channel_type: :SMART, advertising_channel_sub_type: :SMART_CAMPAIGN, url_custom_parameters: [], labels: [], experiment_type: :UNSPECIFIED, campaign_budget: "customers/4897329142/campaignBudgets/-1", bidding_strategy_type: :UNSPECIFIED, accessible_bidding_strategy: "", frequency_caps: [], video_brand_safety_suitability: :UNSPECIFIED, payment_mode: :UNSPECIFIED, excluded_parent_asset_field_types: [], excluded_parent_asset_set_types: []>>>, <Google::ads::GoogleAds::V14::Services::MutateOperation: smart_campaign_setting_operation: <Google::ads::GoogleAds::V14::Services::SmartCampaignSettingOperation: update: <Google::ads::GoogleAds::V14::Resources::SmartCampaignSetting: resource_name: "customers/4897329142/smartCampaignSettings/-2", campaign: "", phone_number: <Google::ads::GoogleAds::V14::Resources::SmartCampaignSetting::PhoneNumber: phone_number: "(602) 815-2760", country_code: "US">, advertising_language_code: "en", final_url: "https://a23349.p3187.c1.store.godaddywp.com/", business_name: "blank">, update_mask: <Google::Protobuf::FieldMask: paths: ["phone_number.phone_number", "phone_number.country_code", "advertising_language_code", "final_url", "business_name"]>>>, <Google::ads::GoogleAds::V14::Services::MutateOperation: campaign_criterion_operation: <Google::ads::GoogleAds::V14::Services::CampaignCriterionOperation: create: <Google::ads::GoogleAds::V14::Resources::CampaignCriterion: resource_name: "", campaign: "customers/4897329142/campaigns/-2", display_name: "", type: :UNSPECIFIED, status: :UNSPECIFIED>>>, <Google::ads::GoogleAds::V14::Services::MutateOperation: ad_group_operation: <Google::ads::GoogleAds::V14::Services::AdGroupOperation: create: <Google::ads::GoogleAds::V14::Resources::AdGroup: resource_name: "customers/4897329142/adGroups/-3", name: "Test SSC ad group #1712701749184", status: :UNSPECIFIED, type: :SMART_CAMPAIGN_ADS, ad_rotation_mode: :UNSPECIFIED, url_custom_parameters: [], campaign: "customers/4897329142/campaigns/-2", optimized_targeting_enabled: false, display_custom_bid_dimension: :UNSPECIFIED, effective_target_cpa_source: :UNSPECIFIED, effective_target_roas_source: :UNSPECIFIED, labels: [], excluded_parent_asset_field_types: [], excluded_parent_asset_set_types: []>>>, <Google::ads::GoogleAds::V14::Services::MutateOperation: ad_group_ad_operation: <Google::ads::GoogleAds::V14::Services::AdGroupAdOperation: create: <Google::ads::GoogleAds::V14::Resources::AdGroupAd: resource_name: "", status: :UNSPECIFIED, ad_group: "customers/4897329142/adGroups/-3", ad: <Google::ads::GoogleAds::V14::Resources::ad: resource_name: "", final_urls: [], final_app_urls: [], final_mobile_urls: [], url_custom_parameters: [], type: :SMART_CAMPAIGN_AD, device_preference: :UNSPECIFIED, url_collections: [], system_managed_resource_source: :UNSPECIFIED>, ad_strength: :UNSPECIFIED,action_items: [], labels: []>>>], partial_failure: false, validate_only: false, response_content_type: :UNSPECIFIED> I, [2024-04-09T22:29:09.690928 #121290] INFO -- : Incoming response (errors): Google::ads::GoogleAds::errors::GoogleAdsError(Google::ads::GoogleAds::errors::GoogleAdsError): The required field was not present.The field attempted to be mutated is immutable. called from: /home/sellbrite/app/lib/requests/google_ads_request_smart_campaign.rb:35:in `create_smart_campaign' Google::ads::GoogleAds::errors::GoogleAdsError: Google::ads::GoogleAds::errors::GoogleAdsError from /home/sellbrite/app/vendor/bundle/ruby/2.7.0/gems/google-ads-googleads-23.1.0/lib/google/ads/google_ads/interceptors/error_interceptor.rb:67:in `rescue in request_response' Caused by GRPC::InvalidArgument: 3:Request contains an invalid argument.. debug_error_string:{UNKNOWN:Error received from peer ipv4:142.251.163.95:443 {grpc_message:"Request contains an invalid argument.", grpc_status:3, created_time:"2024-04-09T22:29:09.686892344+00:00"}} from /home/sellbrite/app/vendor/bundle/ruby/2.7.0/gems/grpc-1.61.0-aarch64-linux/src/ruby/lib/grpc/generic/active_call.rb:29:in `check_status'

Additional response examples + code implementation viewable in https://docs.google.com/document/d/1slXm_fk5DK3L3mPJq_cvYgcfQMZxFfL61q6JUBvZ4Pk/edit

Anything else we should know about your project / environment:

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageNew issues that need to be sorted into other labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions