youtube / api-samples

Code samples for YouTube APIs, including the YouTube Data API, YouTube Analytics API, and YouTube Live Streaming API. The repo contains language-specific directories that contain the samples.
5.5k stars 2.98k forks source link

Content ID API returns 403 when I try to create new asset #421

Open ivogeorgief opened 2 years ago

ivogeorgief commented 2 years ago

I'm trying to use the Youtube Content ID API to monetize a video. The video upload works fine. When I try to create new asset the API returns 403 forbidden and no more info.

` $asset = new \Google_Service_YouTubePartner_Asset(); $metadata = new \Google_Service_YouTubePartner_Metadata();

$metadata->setTitle('test title'); $metadata->setDescription('test desc'); $asset->setMetadata($metadata); $asset->setType("web"); $assetInsertResponse = $this->youtube_partner->assets->insert($asset, ['onBehalfOfContentOwner' => $contentOwnerId]); `

However I am able to create new Policy using

$policy = new \Google_Service_YouTubePartner_Policy(); $policyRule = new \Google_Service_YouTubePartner_PolicyRule(); $policyRule->setAction("monetize"); $policy->setRules(array($policyRule)); $policy->setName('test'); $response = $this->youtube_partner->policies->insert($policy);

NaitoKenzo commented 1 year ago

@ivogeorgief Have you been able to find what was wrong?

ivogeorgief commented 1 year ago

Hi,

Actually no, but I suspect what is the issue. We have one main account and a lot of connected brand accounts. The API is wrongly deciding, that the brand accounts are not enabled for monetization and fails with that message.

On Fri, Jul 21, 2023, 17:31 Kenzo Naito @.***> wrote:

@ivogeorgief https://github.com/ivogeorgief Have you been able to find what was wrong?

— Reply to this email directly, view it on GitHub https://github.com/youtube/api-samples/issues/421#issuecomment-1645687143, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2RTC6UC5F3MEHFHAPUMQP3XRKHDZANCNFSM56WQRSEA . You are receiving this because you were mentioned.Message ID: @.***>