Youtube API - onBehalfOfContentOwner value? - youtube-api

When using this parameter in the Youtube APIs. I am unable to determine the value for 22onBehalfOfContentOwner. I tried using the user id specified for the channel under:
https://www.youtube.com/account_advanced
The channel ID matches the channel I am going for. But I can't seem to be get ContentOwner right. Where can I find the right value to be used in this parameter.
https://developers.google.com/youtube/v3/docs/channels/list?apix_params=%7B%22part%22%3A%22snippet%2CcontentDetails%2Cstatistics%22%2C%22managedByMe%22%3Atrue%2C%22onBehalfOfContentOwner%22%3A%22c4rG0MP16xnAhMRJ4UWxTw%22%7D#usage
I have the Content Manager Access for this channel and I am using my credentials to authenticate with the API.
"message": "The specified content owner account was not found.",

Related

GET user endpoint always returns MY user data, regardless of ID in query

I am querying the Microsoft Graph API to get OneDrive files, like:
GET https://graph.microsoft.com/v1.0/me/drive/root/delta
There is a lastModifiedBy facet in the driveItem resource returned, but it only contains a displayName and id. I need the user's email based on that ID.
So I tried the endpoint from these docs, which is:
GET https://graph.microsoft.com/v1.0/users/{id}
Specifically, I have tried things like:
GET https://graph.microsoft.com/v1.0/users/45aa3379f269b493
But it always returns the exact same set of data (regardless of which id I pass in), which is the data from the https://graph.microsoft.com/v1.0/me endpoint.
My scopes are the following:
offline_access
files.read.all
user.read
user.readbasic.all
people.read
contacts.read
contacts.read.shared
Is there any reason that this endpoint is not returning the data for the specific user ID that I pass? Or is there an alternative way to get the user's email based on the information provided in lastModifiedBy?
Looking at theJSON you posted, I noticed your files have an id using the format xxxxxxxxxxxxxxxx!xxx (note the !). This tells me this is a personal Microsoft Account (MSA).
Since this is a Microsoft Account, there are no "users" beyond yourself. Graph will therefore disregard whatever id you provide and always return your own profile (/me). In order to use /users you need to be connected to an Azure Active Directory tenant.
You cannot pull profile information for other MSA/Outlook.com accounts. Were this supported it would introduce an unacceptable hole in MSA privacy/security.

Where do I find my or my customers YouTube "content owner id"?

Am trying to figure out the API. Were in the web interface can, as an administrator, find the "content owner id" of my managed accounts?
All I see is this:
"To retrieve a content owner report, call the API's reports.query method and set the ids parameter value in the 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."
Surely I don't have to call Google to get this value?
If you want to know the content owner id of only one account, you can check the URI.
There are various ways to retrieve the id from the URI:
Log in on https://studio.youtube.com/ and switch the account to the
one you're trying to get the id of (on the top right click on the
account logo, then on "Switch account"). When you've switched to the
new account, the content owner id should be in the URL in the part
that follows https://studio.youtube.com/owner/.
Go to https://www.youtube.com/analytics and switch to the desired
account. The content owner id is what follows
https://www.youtube.com/analytics?o= and before &ar.
The second option should also work for other sections in the Youtube
creator studio.
If you want to retrieve a list of all content owner IDs linked to your admin account, it's much easier to do it via the API. If you don't want to write a script for that, you can just use the Google API explorer (on the right) here: https://developers.google.com/youtube/partner/docs/v1/contentOwners/list
Just set fetchMine to true and sign in to your account. The output below should give you a list of the content owner names, IDs and other info.
To retrieve the content owner IDs via the API, samples can also be found here:
https://developers.google.com/youtube/partner/code_samples/
(check the docs "Retrieve a content owner's managed channels (channels.list)" in your language).
You may refer with this SO answer on how to get the content owner id.
Assuming you have an OAuth 2 token with access to the https://www.googleapis.com/auth/youtubepartner scope, you can make an API call to youtubePartner.contentOwners.list(fetchMine=true) to get back a list of YouTube content owners associated with the current OAuth 2 token. (There will normally only be one item returned.) You can then get the content owner id value from the id property of each item in the items list that's returned. This is the value that you can use when making content owner YouTube Analytics API reports, or using the onBehalfOfContentOwner delegation parameter in the YouTube Data API v3.
You need to query youtubePartner.contentOwners.list(fetchMine=true) to obtain the content owner info. Also make sure that you have this API available in your console or ask your partner manager if you are eligible for this API.

Youtube API: Get the channel or username from the videoID

I've hunted around, and I'm not seeing how it's possible to fetch any user info by using only a videoID (from a video that a user uploaded), preferably without oAuth. I just need either the user's channel or user name.
https://developers.google.com/youtube/v3/docs/videos/list responds only with video info and requires oAuth.
So, for example. Given the "v" id in this following url, I could fetch the channel id, UCAIIYxc9Q5uHOUeoF3EWzkA, without requiring the user's permission. (this is all public anyway):
https://www.youtube.com/watch?v=FH2zbHrRY9A
Any ideas?
Use the API: https://developers.google.com/youtube/v3/docs/videos/list
The call would be https://www.googleapis.com/youtube/v3/videos?part=snippet&id=FH2zbHrRY9A&key={YOUR_API_KEY}
channelID will be in the snippet returned.

YouTube Api Explorer Usuage as ContentOwner: forbidden

I'd like to get the impressionBasedCpm from the Api Explorer ( and later from my app).
I can log in with an youtube partner account and toggle the oauth switch. I set all scopes to checked.
Then I try to enter
ids: contentOwner==NAME_OF_CONTENT_OWNER (not the id, retrieved from the content API, https://developers.google.com/youtube/partner/docs/v1/contentOwners/list#try-it)
metrics: impressionBasedCpm
start-date: '2015-05-01'
end-date: '2015-06-01'
The output still tells me:
You do not have permission to execute this method.
Can someone help me?
My guess is that when I authorize the application I seam to still login as a channel, so the query as a content owner is not allowed. I picked the main one with the email address. But when I'm on youtube I can switch to a specific Content-Manager Channel/Account.
Even when I try to just get the 'likes' for the contentOwner it doesn't work. If I try to get the likes based on the channel_id it works. But I like to get reports for a youtube partner that uses youtube's cms.
cheers
This query won't work because it does not follow the semantics of the API. You need to provide the ID of the contentOwner in order to get a 200 OK response. Name of Content Owner cannot be unique and hence would lead to erroneous results.

get youtube channel subscribers via youtube API

I'm trying to use youtube api to get a list of subscribers to a channel i own then check a user's Email to find out if he's subscribed or not. Now I'm using this page to test my first step https://developers.google.com/youtube/v3/docs/subscriptions/list and inserting data as follows and all other fields are empty
As you can see I get this error and the part label contains an error while the value is "snippet". how to solve this problem and if solved as I need is it available to get a list of all users' emails subscribed to my channel as a list?
get a list of subscribers to a channel i own
If you want check the subscribers of your YouTube channel you need to use the resource subscription.list with these fields:
part: subscriberSnippet
mySubscribers: true
And authenticate with OAuth2.0.
then check a user's Email
Email is a private information, you can get it only if the owner of the channel give you the permission.

Resources