Hi guys, We are trying to do some integrations on Google Ads API using one of your ruby gems. We can already retrieve some data but can’t create things. I would like to know if you can provide us some help.
I am using this gem: https://github.com/googleads/google-ads-ruby And trying to follow this example: https://github.com/googleads/google-ads-ruby/blob/master/examples/basic_operations/add_ad_groups.rb This is how my code loooks like: ```ruby # This seems to be properly configured since we can get data from google ads api client ||= Google::Ads::GoogleAds::GoogleAdsClient.new do |config| config.client_id = ENV['ADS_CLIENT_ID'] config.client_secret = ENV['ADS_CLIENT_SECRET'] config.refresh_token = ENV['ADS_REFRESH_TOKEN'] config.developer_token = ENV['ADS_DEVELOPER_TOKEN'] config.login_customer_id = ENV['ADS_LOGIN_CUSTOMER_ID'] # manager user customer_id end customer_id = '123123123' # not real campaign_id = '123123123' # not real ad_group = client.resource.ad_group do |ag| ag.name = "Test #{(Time.new.to_f * 1000).to_i}" ag.status = :ENABLED ag.campaign = client.path.campaign(customer_id, campaign_id) # this generates "customers/123123123/campaigns/123123123" ag.type = :SEARCH_STANDARD ag.cpc_bid_micros = 10_000 end # Create the operation ad_group_operation = client.operation.create_resource.ad_group(ad_group) # Add the ad group. response = client.service.ad_group.mutate_ad_groups( customer_id, [ad_group_operation]) puts "Created ad group #{response.results.first.resource_name}." ``` But I always receive this Exception: Error: 'GaxError RPC failed, caused by 3:Request contains an invalid argument.' Cause: '3:Request contains an invalid argument.' Code: 3 Details: 'Request contains an invalid argument.' Request-Id: 'CNtDjMgD6_rAVFBvabbImg' I've tryed a lot of changes but could not figure out what is wrong. The above messages are really generic and did not give me much information about the error. This is the data as we are sending: AdGroupOperation object: <Google::Ads::GoogleAds::V2::Services::AdGroupOperation: create: <Google::Ads::GoogleAds::V2::Resources::AdGroup: resource_name: "", id: nil, name: <Google::Protobuf::StringValue: value: "Test 1565829710761">, status: :ENABLED, url_custom_parameters: [], campaign: <Google::Protobuf::StringValue: value: "customers/123123123/campaigns/123123123">, type: :SEARCH_STANDARD, tracking_url_template: nil, cpc_bid_micros: <Google::Protobuf::Int64Value: value: 10000>, cpm_bid_micros: nil, cpv_bid_micros: nil, base_ad_group: nil, percent_cpc_bid_micros: nil, explorer_auto_optimizer_setting: nil, ad_rotation_mode: :UNSPECIFIED, display_custom_bid_dimension: :UNSPECIFIED, final_url_suffix: nil, targeting_setting: nil, target_cpm_micros: nil, target_cpa_micros: nil, effective_target_cpa_micros: nil, effective_target_cpa_source: :UNSPECIFIED, target_roas: nil, effective_target_roas: nil, effective_target_roas_source: :UNSPECIFIED, labels: []>, update: nil, remove: "", update_mask: nil> Pretty print hash: {:create=> {:resource_name=>"", :id=>nil, :name=>{:value=>"Test 1565829710761"}, :status=>:ENABLED, :url_custom_parameters=>[], :campaign=>{:value=>"customers/123123123/campaigns/123123123"}, :type=>:SEARCH_STANDARD, :tracking_url_template=>nil, :cpc_bid_micros=>{:value=>10000}, :cpm_bid_micros=>nil, :cpv_bid_micros=>nil, :base_ad_group=>nil, :percent_cpc_bid_micros=>nil, :explorer_auto_optimizer_setting=>nil, :ad_rotation_mode=>:UNSPECIFIED, :display_custom_bid_dimension=>:UNSPECIFIED, :final_url_suffix=>nil, :targeting_setting=>nil, :target_cpm_micros=>nil, :target_cpa_micros=>nil, :effective_target_cpa_micros=>nil, :effective_target_cpa_source=>:UNSPECIFIED, :target_roas=>nil, :effective_target_roas=>nil, :effective_target_roas_source=>:UNSPECIFIED, :labels=>[]}, :update=>nil, :remove=>"", :update_mask=>nil} Here is the complete response: (#<struct Struct::BatchResult send_message=true, send_metadata=true, send_close=true, send_status=nil, message=nil, metadata={"request-id"=>"y65rYpIUGBD6OBIQNP5Azw", "date"=>"Thu, 15 Aug 2019 00:47:11 GMT", "alt-svc"=>"quic=\":443\"; ma=2592000; v=\"46,43,39\""}, status=#<struct Struct::Status code=3, details="Request contains an invalid argument.", metadata={"google.ads.googleads.v2.errors.googleadsfailure-bin"=>"\n0\n\x02\b\x01\x12&The error code is not in this version.\x1A\x02*\x00", "grpc-status-details-bin"=>"\b\x03\x12%Request contains an invalid argument.\x1Ay\nCtype.googleapis.com/google.ads.googleads.v2.errors.GoogleAdsFailure\x122\n0\n\x02\b\x01\x12&The error code is not in this version.\x1A\x02*\x00", "request-id"=>"y65rYpIUGBD6OBIQNP5Azw"}>, cancelled=nil>) Here the request: <Google::Ads::GoogleAds::V2::Services::MutateAdGroupsRequest: customer_id: "1111111111", operations: [<Google::Ads::GoogleAds::V2::Services::AdGroupOperation: create: <Google::Ads::GoogleAds::V2::Resources::AdGroup: resource_name: "", id: nil, name: <Google::Protobuf::StringValue: value: "Test 1565830277485">, status: :ENABLED, url_custom_parameters: [], campaign: <Google::Protobuf::StringValue: value: "customers/123123123/campaigns/123123123">, type: :SEARCH_STANDARD, tracking_url_template: nil, cpc_bid_micros: <Google::Protobuf::Int64Value: value: 10000>, cpm_bid_micros: nil, cpv_bid_micros: nil, base_ad_group: nil, percent_cpc_bid_micros: nil, explorer_auto_optimizer_setting: nil, ad_rotation_mode: :UNSPECIFIED, display_custom_bid_dimension: :UNSPECIFIED, final_url_suffix: nil, targeting_setting: nil, target_cpm_micros: nil, target_cpa_micros: nil, effective_target_cpa_micros: nil, effective_target_cpa_source: :UNSPECIFIED, target_roas: nil, effective_target_roas: nil, effective_target_roas_source: :UNSPECIFIED, labels: []>, update: nil, remove: "", update_mask: nil>], partial_failure: false, validate_only: false> request.to_h => {:customer_id=>"1111111111", :operations=> [{:create=> {:resource_name=>"", :id=>nil, :name=>{:value=>"Test 1565830277485"}, :status=>:ENABLED, :url_custom_parameters=>[], :campaign=>{:value=>"customers/123123123/campaigns/123123123"}, :type=>:SEARCH_STANDARD, :tracking_url_template=>nil, :cpc_bid_micros=>{:value=>10000}, :cpm_bid_micros=>nil, :cpv_bid_micros=>nil, :base_ad_group=>nil, :percent_cpc_bid_micros=>nil, :explorer_auto_optimizer_setting=>nil, :ad_rotation_mode=>:UNSPECIFIED, :display_custom_bid_dimension=>:UNSPECIFIED, :final_url_suffix=>nil, :targeting_setting=>nil, :target_cpm_micros=>nil, :target_cpa_micros=>nil, :effective_target_cpa_micros=>nil, :effective_target_cpa_source=>:UNSPECIFIED, :target_roas=>nil, :effective_target_roas=>nil, :effective_target_roas_source=>:UNSPECIFIED, :labels=>[]}, :update=>nil, :remove=>"", :update_mask=>nil}], :partial_failure=>false, :validate_only=>false} Thank you. Fernando Oliveira Software Engineer @ Tidy.com -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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 "AdWords API and Google Ads 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/f7988db7-51fa-4863-9957-caaaf8d0b3da%40googlegroups.com.