【问题标题】:Youtube analytics api giving 'Code:400 The query is not supported.' errorYoutube 分析 api 给出“代码:400 不支持查询。”错误
【发布时间】:2019-12-02 15:14:01
【问题描述】:

我正在使用googleapi 包。

我想从 youtube 分析 API 获取“insightTrafficSourceDetail”。

这是我的代码:

google.youtubeAnalytics('v2').reports.query({
    metrics: 'estimatedMinutesWatched,views',
    dimensions: 'insightTrafficSourceDetail',
    filter: 'video==[some_video_id];insightTrafficSourceType==YT_SEARCH',
    startDate: '2019-01-01',
    endDate: '2019-02-12',
    ids: 'channel==MINE',
    sort: '-estimatedMinutesWatched',
    maxResults: 25,
  });

这是我得到的回复:

  code: 400,
  errors:
   [ { message:
        'The query is not supported. Check the documentation at https://developers.google.com/youtube/analytics/v2/available_reports for a list of supported queries.',
       domain: 'global',
       reason: 'badRequest' } ] }

尽管在谷歌文档中,他们给出了与示例请求相同的请求Top 10 – External websites that generate the most traffic for a video

【问题讨论】:

  • 我遇到了同样的错误。你能找到解决办法吗?
  • 在上面的代码中,应该是'filters'而不是'filter'。当我更换它时,它开始完美运行。确保您发送的所有参数正确且有效
  • 看起来我们没有同样的问题。感谢回复

标签: google-api youtube-javascript-api youtube-analytics-api


【解决方案1】:
google.youtubeAnalytics('v2').reports.query({
    metrics: 'estimatedMinutesWatched,views',
    dimensions: 'insightTrafficSourceDetail',
    filter: 'video==[some_video_id];insightTrafficSourceType==YT_SEARCH',
    startDate: '2019-01-01',
    endDate: '2019-02-12',
    ids: 'channel==MINE',
    sort: '-estimatedMinutesWatched',
    maxResults: 25,
  }); 

在上面的代码中,应该是“过滤器”而不是“过滤器”。当我更换它时,它开始完美运行。

filters: 'video==[some_video_id];insightTrafficSourceType==YT_SEARCH',

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-02-06
    • 2020-11-16
    • 2023-04-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多