Reputation: 5
I am not able to get the Channel Reports using Bulk Report API, though I am not the Primary owner of the CMS, and each CMS has multiple Channels.
Currently, I am using Youtube analytics API to download Channel analytics data for the CMS and its Channels. But due to the limitation of daily quota, it is not downloading complete data.
Using Python, I have developed the code to get the list of the report for the Channels.
def list_report_types(cms):
reporting = youtube.reporting()
request = reporting.reportTypes().list()
results = youtube.query(request)
return results.get('reportTypes')
report_types = list_report_types(cms)
report_types
Code for scheduling a report
name = 'User activity'
report_type_id = 'channel_basic_a2'
request = reporting.jobs().create(
body=dict(reportTypeId=report_type_id,
name=name)
)
reporting_job = youtube.query(request)
This is giving an error
HttpError 403 when requesting https://youtubereporting.googleapis.com/v1/jobs?alt=json&onBehalfOfContentOwner=cmsid returned "The caller does not have permission">
This is due to I am not the Primary owner of the CMS?
Upvotes: 0
Views: 467
Reputation: 6737
Error 404 means that the user is not properly authorized. To have a complete view on how you can use python in your project, check the Python Quickstart. Complete the steps specified here and the user will be able to make request on YouTube Data API.
Upvotes: 0