1

I'm using YouTube Analytics API to find authorize a YouTube channel using OAuth2 and then trying to find the unique viewers that the channel encountered. This is the URL that I'm sending a request to:

https://www.googleapis.com/youtube/analytics/v1/reports?ids=channel==MINE&start-date=2000-06-01&end-date=2016-04-25&metrics=uniques&access_token=XXXX

I'm using the uniques metric in the above case. However, this is what is returned as response:

Array ( 
    [error] => Array ( 
        [errors] => Array ( 
            [0] => Array ( 
                [domain] => 
                global [reason] => 
                badRequest [message] => 
                The query is not supported. 
                Check the documentation at 
                https://developers.google.com/youtube/analytics/v1/available_reports 
                for a list of supported queries. 
            ) 
        ) 
        [code] => 
        400 [message] => 
        The query is not supported. Check the documentation a 
        https://developers.google.com/youtube/analytics/v1/available_reports 
        for a list of supported queries. 
    ) 
 )

What seems to be wrong here?

Noam Hacker
  • 4,671
  • 7
  • 34
  • 55
Manas Chaturvedi
  • 5,210
  • 18
  • 52
  • 104

1 Answers1

0

A 400 response code identifies a bad request. It indicates that a request was poorly formed or contained invalid data. For example, you will receive a 400 response code if you submit a request to the wrong URL or include an unsupported or nonexistent parameter in your request.

I also found the same issue here. The solution for his problem, is that you need to specify the dimension to use the unique queries.

Dimensions are common criteria that are used to aggregate data, such as the date on which the user activity occurred or the country where the users were located.

For more information check this page.

KENdi
  • 7,576
  • 2
  • 16
  • 31