Youtube Analytics API 403 Forbidden

216 views Asked by At

I tried to get views count of videos in channel.

Following is my Ruby code.

client.authorization.access_token = access_token
analytics_response = client.execute(
    :api_method => youtube_analytics.reports.query,
    :parameters => {
      :metrics => "views", 
      :dimensions => "video", 
      "start-date" => "2016-08-31", 
      "end-date" => "2017-08-30", 
      "start-index" => 1, 
      "max-results" => 10, 
      :sort => "-views", 
      :help => "false", 
      :ids => "channel==#{channelID}"
    } 

But I got this error if the channelID is not mine.

{"error"=>{"errors"=>[{"domain"=>"global", "reason"=>"forbidden", "message"=>"Forbidden"}], "code"=>403, "message"=>"Forbidden"}} 

I can get views count of videos in my own channel without error using above code.

How can I get views count of other's channel?

0

There are 0 answers