问题
So, I am trying to use Monetary Analytics API, to fetch earnings report for given YouTube channel. https://developers.google.com/youtube/analytics/v1/content_owner_reports
However, to use this API, the following is required:
To retrieve a content owner report, set the ids parameter value in your API request to contentOwner==OWNER_NAME, where OWNER_NAME specifies the content owner's ID. Ask your partner manager if you are unsure of the value.
So, after browsing online, I've found unofficial documentation, that may be what I'm looking for. http://jump.techden.in/developers.google.com/youtube/partner/docs/v1/contentOwners/list
So I added https://www.googleapis.com/auth/youtubepartner
scope, reauthenticated, and made this request:
def list_content_owners
conn = FaradayAdapter.new("https://www.googleapis.com").conn
params = {
:fetchMine => true,
:key => DEVELOPER_KEY
}
resp = conn.get do |req|
req.url "/youtube/partner/v1/contentOwners", params
req.headers["Authorization"] = "Bearer #{@token}"
end
debugger
return nil unless resp.try(:status) == 200
JSON.parse resp.body || nil
end
However, I get the following 403 error:
(rdb:1) resp.body "{\n \"error\": {\n \"errors\": [\n {\n
\"domain\": \"usageLimits\",\n \"reason\": \"accessNotConfigured\",\n \"message\": \"Access Not Configured\"\n }\n ],\n \"code\": 403,\n \"message\": \"Access Not Configured\"\n }\n}\n"
I've looked into my developer console https://code.google.com/apis/console/ and I already have all YouTube related API's enabled. There is no special partner API listing available.
So, if I can't get contentOwner id
, whats the point of Analytics API?
回答1:
As clearly described in the page you were referring to : https://developers.google.com/youtube/analytics/v1/content_owner_reports
contentOwner is related to Content ID API and and only available to few partners. Make sure you have this API available in your console or ask your partner manager if you are eligible for this API.
来源:https://stackoverflow.com/questions/19584489/youtube-analytics-api-content-owner-reports