YouTube Reporting API - Get Bulk Data Reports
সেভ করা পৃষ্ঠা গুছিয়ে রাখতে 'সংগ্রহ' ব্যবহার করুন
আপনার পছন্দ অনুযায়ী কন্টেন্ট সেভ করুন ও সঠিক বিভাগে রাখুন।
YouTube স্বয়ংক্রিয়ভাবে এমন সামগ্রীর মালিকদের জন্য সিস্টেম-পরিচালিত বিজ্ঞাপন আয়ের প্রতিবেদনের একটি সেট তৈরি করে যাদের ক্রিয়েটর স্টুডিওতে সংশ্লিষ্ট প্রতিবেদনগুলিতে অ্যাক্সেস রয়েছে। এই রিপোর্টগুলি এমন ডেটাতে প্রোগ্রাম্যাটিক অ্যাক্সেস দেওয়ার জন্য ডিজাইন করা হয়েছে যা YouTube ক্রিয়েটর স্টুডিওর রিপোর্ট মেনুতে ম্যানুয়ালি ডাউনলোডযোগ্য রিপোর্টগুলিতে অ্যাক্সেসযোগ্য।
দ্রষ্টব্য: এপিআই ক্রিয়েটর স্টুডিওর চেয়ে ভিন্ন ভিন্ন সেটে অ্যাক্সেস প্রদান করে, যদিও রিপোর্টে একই ধরনের ডেটা থাকে। এপিআই রিপোর্টের বিভিন্ন ক্ষেত্র থাকতে পারে এবং ক্রিয়েটর স্টুডিও রিপোর্টের তুলনায় বিভিন্ন ক্ষেত্রের নাম ব্যবহার করতে পারে।
যেহেতু YouTube স্বয়ংক্রিয়ভাবে সিস্টেম-পরিচালিত প্রতিবেদন তৈরি করে, তাই এই প্রতিবেদনগুলি পুনরুদ্ধার করার প্রক্রিয়াটি API-এর মাধ্যমে উপলব্ধ YouTube Analytics বাল্ক ডেটা রিপোর্টের চেয়ে আলাদা।
রিপোর্ট পুনরুদ্ধার করা হচ্ছে
নিম্নলিখিত পদক্ষেপগুলি API-এর মাধ্যমে কীভাবে সিস্টেম-পরিচালিত প্রতিবেদনগুলি পুনরুদ্ধার করতে হয় তা ব্যাখ্যা করে৷
ধাপ 1: অনুমোদনের শংসাপত্র পুনরুদ্ধার করুন
সমস্ত YouTube রিপোর্টিং API অনুরোধ অনুমোদিত হতে হবে। অনুমোদন নির্দেশিকা ব্যাখ্যা করে কিভাবে অনুমোদন টোকেন পুনরুদ্ধার করতে OAuth 2.0 প্রোটোকল ব্যবহার করতে হয়।
YouTube রিপোর্টিং API অনুরোধগুলি নিম্নলিখিত অনুমোদনের সুযোগগুলি ব্যবহার করে:
স্কোপ |
---|
https://www.googleapis.com/auth/yt-analytics.readonly | আপনার YouTube সামগ্রীর জন্য YouTube বিশ্লেষণ প্রতিবেদনগুলি দেখুন৷ এই সুযোগ ব্যবহারকারীর কার্যকলাপ মেট্রিক্সে অ্যাক্সেস প্রদান করে, যেমন ভিউ সংখ্যা এবং রেটিং গণনা। |
https://www.googleapis.com/auth/yt-analytics-monetary.readonly | আপনার YouTube বিষয়বস্তুর জন্য YouTube Analytics আর্থিক প্রতিবেদনগুলি দেখুন৷ এই সুযোগ ব্যবহারকারী কার্যকলাপ মেট্রিক্স এবং আনুমানিক আয় এবং বিজ্ঞাপন কর্মক্ষমতা মেট্রিক্স অ্যাক্সেস প্রদান করে. |
ধাপ 2: পছন্দসই রিপোর্টের জন্য কাজের আইডি পুনরুদ্ধার করুন
সিস্টেম-পরিচালিত কাজের তালিকা পুনরুদ্ধার করতে jobs.list
পদ্ধতিতে কল করুন। includeSystemManaged
প্যারামিটারটি true
এ সেট করুন।
প্রতিটি রিটার্ন করা Job
রিসোর্সে reportTypeId
প্রপার্টি সেই কাজের সাথে যুক্ত সিস্টেম-ম্যানেজড রিপোর্টের ধরন শনাক্ত করে। নিম্নলিখিত ধাপে আপনার আবেদনের জন্য একই সংস্থান থেকে id
সম্পত্তি মান প্রয়োজন।
রিপোর্ট নথিতে উপলব্ধ রিপোর্ট, তাদের রিপোর্টের ধরন আইডি, এবং যে ক্ষেত্রগুলি রয়েছে তা তালিকাভুক্ত করে। সমর্থিত রিপোর্ট প্রকারের তালিকা পুনরুদ্ধার করতে আপনি reportTypes.list
পদ্ধতিও ব্যবহার করতে পারেন।
ধাপ 3: রিপোর্টের ডাউনলোড URL পুনরুদ্ধার করুন
কাজের জন্য তৈরি করা রিপোর্টের তালিকা পুনরুদ্ধার করতে jobs.reports.list
পদ্ধতিতে কল করুন। অনুরোধে, আপনি যে রিপোর্টটি পুনরুদ্ধার করতে চান তার কাজের আইডিতে jobId
প্যারামিটার সেট করুন।
আপনি নিম্নলিখিত প্যারামিটারগুলির যেকোনো একটি বা সমস্ত ব্যবহার করে প্রতিবেদনের তালিকা ফিল্টার করতে পারেন:
এপিআই শুধুমাত্র একটি নির্দিষ্ট সময়ের পরে তৈরি করা রিপোর্টগুলি ফেরত দেবে তা নির্দেশ করার জন্য createdAfter
প্যারামিটার ব্যবহার করুন। এই পরামিতিটি নিশ্চিত করতে ব্যবহার করা যেতে পারে যে API শুধুমাত্র সেই রিপোর্টগুলি ফেরত দেয় যা আপনি ইতিমধ্যে প্রক্রিয়া করেননি।
startTimeBefore
প্যারামিটার ব্যবহার করে নির্দেশ করুন যে API প্রতিক্রিয়াতে শুধুমাত্র রিপোর্ট থাকা উচিত যদি রিপোর্টের প্রথমতম ডেটা নির্দিষ্ট তারিখের আগে হয়। যেখানে createdAfter
পরামিতি প্রতিবেদনটি তৈরি করার সময় সম্পর্কিত, এই তারিখটি প্রতিবেদনের ডেটার সাথে সম্পর্কিত।
startTimeAtOrAfter
প্যারামিটার ব্যবহার করে নির্দেশ করুন যে API প্রতিক্রিয়াতে শুধুমাত্র রিপোর্ট থাকা উচিত যদি রিপোর্টের প্রথমতম ডেটা নির্দিষ্ট তারিখে বা তার পরে থাকে। startTimeBefore
প্যারামিটারের মতো, এই প্যারামিটারের মান রিপোর্টের ডেটার সাথে মিলে যায় এবং রিপোর্ট তৈরির সময় নয়।
API প্রতিক্রিয়াতে সেই কাজের জন্য Report
সংস্থানগুলির একটি তালিকা রয়েছে৷ প্রতিটি সংস্থান এমন একটি প্রতিবেদনকে বোঝায় যাতে একটি অনন্য সময়ের জন্য ডেটা থাকে।
- রিসোর্সের
startTime
এবং endTime
বৈশিষ্ট্যগুলি রিপোর্টের ডেটা কভার করার সময়কালকে চিহ্নিত করে৷ - রিসোর্সের
downloadUrl
প্রপার্টি সেই URLটিকে চিহ্নিত করে যেখান থেকে রিপোর্ট আনা যেতে পারে। - রিসোর্সের
createTime
প্রপার্টি রিপোর্ট তৈরি করার তারিখ এবং সময় নির্দিষ্ট করে। আপনার অ্যাপ্লিকেশানটিকে এই মানটি সংরক্ষণ করা উচিত এবং পূর্বে ডাউনলোড করা প্রতিবেদনগুলি পরিবর্তিত হয়েছে কিনা তা নির্ধারণ করতে এটি ব্যবহার করা উচিত।
ধাপ 4: প্রতিবেদনটি ডাউনলোড করুন
প্রতিবেদনটি পুনরুদ্ধার করতে ধাপ 4 এ প্রাপ্ত downloadUrl
-এ একটি HTTP GET অনুরোধ পাঠান।
রিপোর্ট প্রক্রিয়াকরণ
সর্বোত্তম অনুশীলন
যে অ্যাপ্লিকেশনগুলি YouTube রিপোর্টিং API ব্যবহার করে তাদের সর্বদা এই অনুশীলনগুলি অনুসরণ করা উচিত:
রিপোর্টের কলামের ক্রম নির্ধারণ করতে রিপোর্টের হেডার সারি ব্যবহার করুন। উদাহরণ স্বরূপ, অনুমান করবেন না যে ভিউ একটি রিপোর্টে প্রথম মেট্রিক প্রত্যাবর্তিত হবে কারণ এটি একটি প্রতিবেদনের বিবরণে তালিকাভুক্ত প্রথম মেট্রিক। পরিবর্তে, কোন কলামে সেই ডেটা রয়েছে তা নির্ধারণ করতে প্রতিবেদনের হেডার সারিটি ব্যবহার করুন৷
একই রিপোর্ট বারবার প্রসেসিং এড়াতে আপনার ডাউনলোড করা রিপোর্টের রেকর্ড রাখুন। নিম্নলিখিত তালিকাটি এটি করার কয়েকটি উপায়ের পরামর্শ দেয়।
reports.list
পদ্ধতিতে কল করার সময়, শুধুমাত্র একটি নির্দিষ্ট তারিখের পরে তৈরি রিপোর্ট পুনরুদ্ধার করতে createAfter প্যারামিটার ব্যবহার করুন। (প্রথমবার রিপোর্ট পুনরুদ্ধার করার পর createdAfter
পরামিতি বাদ দিন।)
প্রতিবার যখন আপনি রিপোর্টগুলি পুনরুদ্ধার করবেন এবং সফলভাবে প্রক্রিয়া করবেন, সেই তারিখ এবং সময়ের সাথে সম্পর্কিত টাইমস্ট্যাম্প সংরক্ষণ করুন যখন সেই রিপোর্টগুলির মধ্যে নতুনটি তৈরি হয়েছিল৷ তারপরে, প্রতিটি পরপর কলে reports.list
পদ্ধতিতে createdAfter
প্যারামিটার মান আপডেট করুন যাতে আপনি প্রত্যেকবার API কল করার সময় ব্যাকফিল করা ডেটা সহ নতুন রিপোর্ট সহ শুধুমাত্র নতুন রিপোর্ট পুনরুদ্ধার করছেন।
একটি সুরক্ষা হিসাবে, একটি রিপোর্ট পুনরুদ্ধার করার আগে, রিপোর্টের আইডি আপনার ডাটাবেসে ইতিমধ্যেই তালিকাভুক্ত করা হয়নি তা নিশ্চিত করতে পরীক্ষা করুন৷
আপনার ডাউনলোড করা এবং প্রক্রিয়া করা প্রতিটি রিপোর্টের জন্য আইডি সংরক্ষণ করুন। এছাড়াও আপনি অতিরিক্ত তথ্য সঞ্চয় করতে পারেন যেমন তারিখ এবং সময় যখন প্রতিটি প্রতিবেদন তৈরি করা হয়েছিল বা প্রতিবেদনের startTime
এবং endTime
, যা একসাথে সেই সময়কালকে চিহ্নিত করে যার জন্য রিপোর্টে ডেটা রয়েছে৷ YouTube Analytics-এর জন্য বাল্ক ডেটা পুনরুদ্ধার করে এমন রিপোর্টগুলির জন্য, প্রতিটি কাজের সম্ভবত অনেকগুলি রিপোর্ট থাকবে কারণ প্রতিটি রিপোর্টে 24-ঘন্টা সময়ের জন্য ডেটা থাকে৷ সিস্টেম-পরিচালিত কাজগুলি যা দীর্ঘ সময়ের কভার করে সেগুলির কম রিপোর্ট থাকবে৷
আপনাকে এখনও ডাউনলোড এবং আমদানি করতে হবে এমন রিপোর্ট শনাক্ত করতে রিপোর্ট আইডি ব্যবহার করুন। যাইহোক, যদি দুটি নতুন রিপোর্টের startTime
এবং endTime
প্রপার্টির মান একই থাকে, শুধুমাত্র নতুন createTime
মান সহ রিপোর্ট আমদানি করুন।
রিপোর্ট বৈশিষ্ট্য
এপিআই রিপোর্টগুলি ভার্সন করা হয় .csv
(কমা-বিভক্ত মান) ফাইল যেগুলির নিম্নলিখিত বৈশিষ্ট্য রয়েছে:
প্রতিটি রিপোর্টে রিপোর্টের শুরুর তারিখে প্রশান্ত মহাসাগরীয় সময় 12:00 am থেকে রিপোর্টের শেষ তারিখে 11:59 pm প্রশান্ত মহাসাগরীয় সময় পর্যন্ত স্থায়ী একটি অনন্য সময়ের জন্য ডেটা থাকে৷
রিপোর্ট তথ্য বাছাই করা হয় না.
অন্য কিছু উল্লেখ না করা থাকলে, এই পৃষ্ঠার কন্টেন্ট Creative Commons Attribution 4.0 License-এর অধীনে এবং কোডের নমুনাগুলি Apache 2.0 License-এর অধীনে লাইসেন্স প্রাপ্ত। আরও জানতে, Google Developers সাইট নীতি দেখুন। Java হল Oracle এবং/অথবা তার অ্যাফিলিয়েট সংস্থার রেজিস্টার্ড ট্রেডমার্ক।
2025-08-21 UTC-তে শেষবার আপডেট করা হয়েছে।
[null,null,["2025-08-21 UTC-তে শেষবার আপডেট করা হয়েছে।"],[[["\u003cp\u003eYouTube's Reporting API provides access to system-managed ad revenue reports, which differ from Creator Studio reports in terms of fields and naming, yet contain similar data.\u003c/p\u003e\n"],["\u003cp\u003eRetrieving these reports involves four steps: getting authorization credentials, retrieving the job ID, getting the report's download URL, and downloading the report.\u003c/p\u003e\n"],["\u003cp\u003eThe API requires specific authorization scopes, either \u003ccode\u003ehttps://www.googleapis.com/auth/yt-analytics.readonly\u003c/code\u003e for general user activity metrics or \u003ccode\u003ehttps://www.googleapis.com/auth/yt-analytics-monetary.readonly\u003c/code\u003e for monetary and ad performance metrics.\u003c/p\u003e\n"],["\u003cp\u003eBest practices for using the API include using the header row to identify column ordering and keeping a record of downloaded reports to avoid reprocessing the same data, while also checking for updated reports.\u003c/p\u003e\n"],["\u003cp\u003eEach report is a \u003ccode\u003e.csv\u003c/code\u003e file containing data for a specific period, from 12:00 a.m. to 11:59 p.m. Pacific Time, and the data within the reports is not sorted.\u003c/p\u003e\n"]]],["YouTube provides system-managed ad revenue reports accessible via the Reporting API. To retrieve these reports, first, obtain authorization credentials using OAuth 2.0. Next, retrieve the job ID for the desired report type by calling `jobs.list` with `includeSystemManaged` set to `true`. Then, call `jobs.reports.list`, providing the job ID, to get the report's download URL, which may be filtered by creation or start times. Finally, use an HTTP GET request to download the report. Remember to store downloaded report details to avoid reprocessing.\n"],null,["# YouTube Reporting API - Get Bulk Data Reports\n\nYouTube automatically generates a set of system-managed ad revenue reports for content owners that have access to the corresponding reports in [Creator Studio](http://studio.youtube.com/). These reports are designed to provide programmatic access to data that is also available in manually downloadable reports accessible in the [Reports menu](https://support.google.com/youtube/answer/7648605) of the YouTube Creator Studio.\n\n**Note:** The API provides access to a different set of reports than Creator Studio, though the reports contain similar data. API reports might have different fields and also use different field names than Creator Studio reports.\n\nSince YouTube automatically generates system-managed reports, the process for retrieving these reports is different than for the YouTube Analytics bulk data reports available via the API.\n\nRetrieving reports\n------------------\n\nThe following steps explain how to retrieve system-managed reports via the API.\n\n### Step 1: Retrieve authorization credentials\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\n### Step 2: Retrieve the job ID for the desired report\n\nCall the `jobs.list` method to retrieve a list of system-managed jobs. Set the [includeSystemManaged](/youtube/reporting/v1/reference/rest/v1/jobs/list#includeSystemManaged) parameter to `true`.\n\nThe [reportTypeId](/youtube/reporting/v1/reference/rest/v1/jobs#reportTypeId) property in each returned `Job` resource identifies the type of system-managed report associated with that job. Your application needs the [id](/youtube/reporting/v1/reference/rest/v1/jobs#id) property value from the same resource in the following step.\n\nThe [Reports](/youtube/reporting/v1/reports/system_managed/reports) document lists available reports, their report type IDs, and the fields they contain. You can also use the [reportTypes.list](/youtube/reporting/v1/reference/rest/v1/reportTypes/list) method to retrieve a list of supported report types.\n\n### Step 3: Retrieve the report's download URL\n\nCall the `jobs.reports.list` method to retrieve a list of reports created for the job. In the request, set the [jobId](/youtube/reporting/v1/reference/rest/v1/jobs.reports/list#jobId) parameter to the job ID of the report that you want to retrieve.\n\nYou can filter the list of reports using any or all of the following parameters:\n\n- Use the [createdAfter](/youtube/reporting/v1/reference/rest/v1/jobs.reports/list#createdAfter) parameter to indicate that the API should only return reports created after a specified time. This parameter can be used to ensure that the API only returns reports that you have not already processed.\n\n- Use the [startTimeBefore](/youtube/reporting/v1/reference/rest/v1/jobs.reports/list#startTimeBefore) parameter to indicate that the API response should only contain reports if the earliest data in the report is before the specified date. Whereas the `createdAfter` parameter pertains to the time the report was created, this date pertains to the data in the report.\n\n- Use the [startTimeAtOrAfter](/youtube/reporting/v1/reference/rest/v1/jobs.reports/list#startTimeAtOrAfter) parameter to indicate that the API response should only contain reports if the earliest data in the report is on or after the specified date. Like the `startTimeBefore` parameter, this parameter value corresponds to the data in the report and not the time the report was created.\n\nThe API response contains a list of `Report` resources for that job. Each resource refers to a report that contains data for a unique period.\n\n- The resource's [startTime](/youtube/reporting/v1/reference/rest/v1/jobs.reports#startTime) and [endTime](/youtube/reporting/v1/reference/rest/v1/jobs.reports#endTime) properties identify the time period that the report's data covers.\n- The resource's [downloadUrl](/youtube/reporting/v1/reference/rest/v1/jobs.reports#downloadUrl) property identifies the URL from which the report can be fetched.\n- The resource's [createTime](/youtube/reporting/v1/reference/rest/v1/jobs.reports#createTime) property specifies the date and time when the report was generated. Your application should store this value and use it to determine whether previously downloaded reports have changed.\n\n### Step 4: Download the report\n\nSend an HTTP GET request to the `downloadUrl` obtained in step 4 to retrieve the report.\n\nProcessing reports\n------------------\n\n### Best practices\n\nApplications that use the YouTube Reporting API should *always* follow these practices:\n\n- Use a report's header row to determine the ordering of the report's columns. For example, do not assume that [views](/youtube/reporting/v1/reports/metrics#views) will be the first metric returned in a report just because it is the first metric listed in a report description. Instead, use the report's header row to determine which column contains that data.\n\n- Keep a record of the reports you have downloaded to avoid repeatedly processing the same report. The following list suggests a couple of ways to do that.\n\n - When calling the [reports.list](/youtube/reporting/v1/reference/rest/v1/jobs.reports/list) method, use the [createdAfter](/youtube/reporting/v1/reference/rest/v1/jobs.reports/list#createdAfter) parameter to only retrieve reports created after a certain date. (Omit the `createdAfter` parameter the first time you retrieve reports.)\n\n Each time you retrieve and successfully process reports, store the timestamp corresponding to the [date and time](/youtube/reporting/v1/reference/rest/v1/jobs.reports#createTime) when the newest of those reports was created. Then, update the `createdAfter` parameter value on each successive call to the [reports.list](/youtube/reporting/v1/reference/rest/v1/jobs.reports/list) method to ensure that you are only retrieving new reports, including new reports with backfilled data, each time you call the API.\n\n As a safeguard, before retrieving a report, also check to ensure that the report's [ID](/youtube/reporting/v1/reference/rest/v1/jobs.reports#id) is not already listed in your database.\n - Store the [ID](/youtube/reporting/v1/reference/rest/v1/jobs.reports#id) for each report that you have downloaded and processed. You can also store additional information like the [date and time](/youtube/reporting/v1/reference/rest/v1/jobs.reports#createTime) when each report was generated or the report's [startTime](/youtube/reporting/v1/reference/rest/v1/jobs.reports#startTime) and [endTime](/youtube/reporting/v1/reference/rest/v1/jobs.reports#endTime), which together identify the period for which the report contains data. For reports that retrieve bulk data for YouTube Analytics, each job will likely have many reports since each report contains data for a 24-hour period. System-managed jobs that cover longer time periods will have fewer reports.\n\n Use the report ID to identify reports that you still need to download and import. However, if two new reports have the same [startTime](/youtube/reporting/v1/reference/rest/v1/jobs.reports#startTime) and [endTime](/youtube/reporting/v1/reference/rest/v1/jobs.reports#endTime) property values, only import the report with the newer [createTime](/youtube/reporting/v1/reference/rest/v1/jobs.reports#createTime) value.\n\n### Report characteristics\n\nAPI reports are versioned `.csv` (comma-separated values) files that have the following characteristics:\n\n- Each report contains data for a unique period lasting from 12:00 a.m. Pacific time on the report's start date through 11:59 p.m. Pacific time on the report's end date.\n\n- Report data is not sorted."]]