0
votes

I am using the YouTube Content ID API with their PHP Client Library. I have enabled the API in my console, and am using a YouTube Partner account.

$youtubePartner = new Google_Service_YouTubePartner($client);
$asset = new Google_Service_YouTubePartner_Asset();
$metadata2 = new Google_Service_YouTubePartner_Metadata();
$metadata2->{mymetadata};
$asset->setMetadata($metadata2);
$asset->setType("web");

$assetInsertResponse = $youtubePartner->assets->insert($asset);

There's some other stuff after involving policy and ownership, but it seems to be failing at this point:

Caught Google service Exception 404 message is Error calling POST https://www.googleapis.com/youtube/partner/v1/assets: (404)

If I hit that URL in my browser, I get a response (requires Auth). I've authorized everything correctly (it would give a different error message).

I'm using the YouTubePartner.php from https://developers.google.com/youtube/partner/client_libraries

Why would I be getting a 404 even though the URL is there? Is there something weird about this library or am I doing something fundamentally wrong here?

1
You need to be using v3 of the API. v1 and v2 have been deprecated. Docs here.JAL
Are you sure? Because if you look at the ContentID API it shows the v1 link. developers.google.com/youtube/partner/docs/v1/assets/insertRussell Ingram
Yeah, just tried hitting v3 instead and receieved: Caught Google service Exception 404 message is Error calling POST googleapis.com/youtube/partner/v3/assets: (404)Russell Ingram

1 Answers

1
votes

You should add onBehalfofContentOWner parameter in your requests. Here are samples: https://developers.google.com/youtube/partner/code_samples/php