我正试图通过使用他们的API获得我通过他们的UI看到的相同报告。
当我指定以下度量和维度时,查询不起作用:
- 指标-视图、查看器百分比、估计的分钟数、平均视图持续时间、平均视图百分比
- 维度-insightTrafficSourceType
但是,如果我将指标缩减为:views,estimatedMinutesWatched,则查询工作正常。
以下是我在YouTube API错误的情况下得到的回复:
HTTP/1.1 400 Bad Request
Vary: Origin
Vary: X-Origin
Content-Type: application/json; charset=UTF-8
Date: Wed, 06 Jan 2016 09:01:17 GMT
Expires: Wed, 06 Jan 2016 09:01:17 GMT
Cache-Control: private, max-age=0
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Server: GSE
Alternate-Protocol: 443:quic,p=1
Alt-Svc: quic=":443"; ma=604800; v="30,29,28,27,26,25"
Content-Length: 461
{
"error": {
"errors": [
{
"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 at https://developers.google.com/youtube/analytics/v1/available_reports for a list of supported queries."
}
}
我以前在使用无效过滤器或维度时看到过这个错误。我能够用Google API资源管理器复制这个问题,当我删除"viewerPercentage"指标时,这个问题就消失了。这很奇怪,因为它在YouTube文档中显示为受支持的核心指标:https://developers.google.com/youtube/analytics/v1/dimsmets/mets#viewerPercentage.我找不到任何关于它被弃用的信息,所以我不确定除了它之外的原因似乎是Youtube Analytics API的问题。