YouTube Reporting API
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
借助 YouTube Reporting API,开发者可以安排报告作业,然后下载生成的批量报告。该 API 支持一组预定义的报告,每份报告都包含面向频道或内容所有者的全套 YouTube 数据分析数据。
以下步骤介绍了如何安排报告作业和检索报告:
- 调用
reportTypes.list()
方法可检索频道或内容所有者可以检索的报告列表。 - 调用
jobs.create()
方法来标识应为频道或内容所有者生成的报告。随后,您可以使用 API 的 jobs.list()
和 jobs.delete()
来检索或更改正在生成的报告列表。 - 调用
jobs.reports.list()
方法可检索已针对特定作业生成的一系列报告。响应中的每个资源都包含一个 downloadUrl
属性,用于指定可从中下载报告的网址。 - 发送经过授权的
GET
请求,以从下载网址检索报告。
授权
所有 YouTube Reporting API 请求都必须获得授权。授权指南介绍了如何使用 OAuth 2.0 协议检索授权令牌。
YouTube Reporting API 请求使用以下授权范围:
范围 |
https://www.googleapis.com/auth/yt-analytics.readonly |
查看 YouTube 分析工具为您的 YouTube 内容出具的报告。此范围可提供对用户活动指标(例如观看次数和评分次数)的访问权限。 |
https://www.googleapis.com/auth/yt-analytics-monetary.readonly |
查看 YouTube 分析工具为您的 YouTube 内容出具的财务报告。此范围可提供对用户活动指标以及估计收入和广告效果指标的访问权限。 |
资源类型
以下部分简要介绍了该 API 的资源和方法。表格中显示的所有方法 URI 都是相对于 https://youtubereporting.googleapis.com
的。
方法 |
create |
POST /v1/jobs
创建报告作业。创建报告作业后,您即指示 YouTube 每天生成相应报告。报告会在作业创建后的 24 小时内生成。 |
delete |
DELETE /v1/jobs/{jobId}
删除报告作业。 |
get |
GET /v1/jobs/{jobId}
检索有关已为频道或内容所有者安排的特定报告作业的信息。 |
list |
GET /v1/jobs
列出已为频道或内容所有者安排的报告作业。响应中的每个资源都包含一个 id 属性,用于指定 YouTube 用来唯一标识作业的 ID。您需要该 ID 来检索为相应作业生成的报告列表,或删除该作业。 |
方法 |
get |
GET /v1/jobs/{jobId}/reports/{reportId}
检索特定报告的元数据。 |
list |
GET /v1/jobs/{jobId}/reports
列出已为指定报告作业生成的报告。 |
方法 |
list |
GET /v1/reportTypes
返回频道或内容所有者可以检索的报告类型列表。 |
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-21。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-21。"],[[["\u003cp\u003eThe YouTube Reporting API allows developers to schedule and download bulk reports containing comprehensive YouTube Analytics data for channels or content owners.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can use the API to retrieve a list of available reports, create jobs to generate reports, and manage these jobs through listing and deletion.\u003c/p\u003e\n"],["\u003cp\u003eGenerated reports can be downloaded via a specified URL obtained from the API's response, after retrieving them by using the \u003ccode\u003ejobs.reports.list()\u003c/code\u003e method.\u003c/p\u003e\n"],["\u003cp\u003eThe API requires OAuth 2.0 authorization, and provides scopes for viewing user activity metrics (\u003ccode\u003ehttps://www.googleapis.com/auth/yt-analytics.readonly\u003c/code\u003e) and monetary reports (\u003ccode\u003ehttps://www.googleapis.com/auth/yt-analytics-monetary.readonly\u003c/code\u003e).\u003c/p\u003e\n"]]],["Developers use the YouTube Reporting API to schedule and download bulk reports containing YouTube Analytics data. Key actions include: listing available report types via `reportTypes.list()`, creating reporting jobs with `jobs.create()`, and managing jobs using `jobs.list()` and `jobs.delete()`. To get data, retrieve generated reports for a specific job with `jobs.reports.list()`, each with a downloadable URL. Finally, you can request the download using the given URL. All actions require authorization via OAuth 2.0.\n"],null,["The YouTube Reporting API enables developers to schedule reporting jobs and then download generated bulk reports. The API supports a predefined set of reports, each of which contains a comprehensive set of YouTube Analytics data for a channel or content owner.\n\nThe steps below explain how to schedule reporting jobs and retrieve reports:\n\n1. Call the [reportTypes.list()](/youtube/reporting/v1/reference/rest/v1/reportTypes/list) method to retrieve a list of reports that a channel or content owner can retrieve.\n2. Call the [jobs.create()](/youtube/reporting/v1/reference/rest/v1/jobs/create) method to identify a report that should be generated for a channel or content owner. You can subsequently use the API's [jobs.list()](/youtube/reporting/v1/reference/rest/v1/jobs/list) and [jobs.delete()](/youtube/reporting/v1/reference/rest/v1/jobs/delete) to retrieve or change the list of reports being generated.\n3. Call the [jobs.reports.list()](/youtube/reporting/v1/reference/rest/v1/jobs.reports/list) method to retrieve a list of reports that have been generated for a particular job. Each resource in the response contains a [downloadUrl](/youtube/reporting/v1/reference/rest/v1/jobs.reports#downloadUrl) property that specifies the URL from which the report can be downloaded.\n4. Send an authorized `GET` request to retrieve the report from the download URL.\n\n\u003cbr /\u003e\n\nAuthorization\n\nAll YouTube Reporting API requests must be authorized. The [Authorization guide](/youtube/reporting/guides/authorization) explains how to use the OAuth 2.0 protocol to retrieve authorization tokens.\n\nYouTube Reporting API requests use the following authorization scopes:\n\n| Scopes ||\n|----------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| https://www.googleapis.com/auth/yt-analytics.readonly | View YouTube Analytics reports for your YouTube content. This scope provides access to user activity metrics, like view counts and rating counts. |\n| https://www.googleapis.com/auth/yt-analytics-monetary.readonly | View YouTube Analytics monetary reports for your YouTube content. This scope provides access to user activity metrics and to estimated revenue and ad performance metrics. |\n\nResource types\n\nThe following sections provide general descriptions of the API's resources and methods. All method URIs shown in the tables are relative to `https://youtubereporting.googleapis.com`.\n\n[jobs](/youtube/reporting/v1/reference/rest/v1/jobs)\n\n| Methods ||\n|---------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [create](/youtube/reporting/v1/reference/rest/v1/jobs/create) | `POST /v1/jobs` Creates a reporting job. By creating a reporting job, you are instructing YouTube to generate that report on a daily basis. The report is available within 24 hours of the time that the job is created. |\n| [delete](/youtube/reporting/v1/reference/rest/v1/jobs/delete) | `DELETE /v1/jobs/{jobId}` Deletes a reporting job. |\n| [get](/youtube/reporting/v1/reference/rest/v1/jobs/get) | `GET /v1/jobs/{jobId}` Retrieves information about a specific reporting job that has been scheduled for a channel or content owner. |\n| [list](/youtube/reporting/v1/reference/rest/v1/jobs/list) | `GET /v1/jobs` Lists reporting jobs that have been scheduled for a channel or content owner. Each resource in the response contains an `id` property, which specifies the ID that YouTube uses to uniquely identify the job. You need that ID to retrieve the list of reports that have been generated for the job or to delete the job. |\n\n[jobs.reports](/youtube/reporting/v1/reference/rest/v1/jobs.reports)\n\n| Methods ||\n|-------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------|\n| [get](/youtube/reporting/v1/reference/rest/v1/jobs.reports/get) | `GET /v1/jobs/{jobId}/reports/{reportId}` Retrieves the metadata for a specific report. |\n| [list](/youtube/reporting/v1/reference/rest/v1/jobs.reports/list) | `GET /v1/jobs/{jobId}/reports` Lists reports that have been generated for the specified reporting job. |\n\n[reportTypes](/youtube/reporting/v1/reference/rest/v1/reportTypes)\n\n| Methods ||\n|------------------------------------------------------------------|------------------------------------------------------------------------------------------------------|\n| [list](/youtube/reporting/v1/reference/rest/v1/reportTypes/list) | `GET /v1/reportTypes` Returns a list of report types that the channel or content owner can retrieve. |"]]