Hi Mitchell,
Thank you. Given query was OK.
But with metrics.cost_micros, I got GRPC::InvalidArgument error error again.

require_relative './collector'
require 'google/ads/google_ads'

client = Google::Ads::GoogleAds::GoogleAdsClient.new(Dir.pwd + 
"/google_ads_config.rb")

query = <<~QUERY
  SELECT
    metrics.conversions,
    metrics.cost_micros, 
    video.id,
    segments.conversion_action_category
  FROM
    video
  WHERE 
    segments.conversion_action_category = PAGE_VIEW
QUERY

customer_id = "XXXXXXXXX"

responses = client.service.google_ads.search_stream(customer_id, query)
responses.each do |response|
  begin
    response.results.each do |row|
      metrics = row.metrics
      video = row.video
      segments = row.segments
      puts "video.id: #{video.id}, metrics.conversions: #{metrics.conversions}, 
metrics.cost_micros: #{metrics.cost_micros}, conversion_action_category: 
#{segments.conversion_action_category}"
    end
  end
end


/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/grpc-1.27.0-universal-darwin
/src/ruby/lib/grpc/generic/active_call.rb:31:in `check_status': 3:Request 
contains an invalid argument. (GRPC::InvalidArgument)


Is there some fields combination that is not allowed?

On Saturday, March 28, 2020 at 12:43:12 AM UTC+9, adsapiforumadvisor wrote:
>
> Hi Yuichiro,
>
> Thank you for reaching out. If you want to filter by a segment, that 
> segment must also be in your SELECT clause. For example, you should change 
> your original query to:
>
>  SELECT metrics.conversions, video.id, segments.conversion_action_category
>   FROM video
>   WHERE segments.conversion_action_category = PAGE_VIEW
>
> Regards,
> Mitchell
> Google Ads API Team
>
> ref:_00D1U1174p._5001UXWykq:ref
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/e7f9d58e-b2be-414d-8335-45e98c6ce1c2%40googlegroups.com.

Reply via email to