Issue about Youtube Video Media creation

73 views
Skip to first unread message

Youssef Boussafa

unread,
Nov 24, 2015, 8:44:24 AM11/24/15
to AdWords API Forum
Hi,

I'm trying to create an In-stream video ad. According to template documentation, It seems that we need to create the media ad first, in order to get the media id. I've tried first create the Youtube Video Media as you can see below :

$user = new AdWordsUser();
$user->SetClientCustomerId('727-815-6373');
$mediaService = $user->GetService('MediaService', ADWORDS_VERSION);
$video = new Video();
$video->name='Youtube Video AD #' . uniqid();
$video->type = 'VIDEO';
$video->youTubeVideoIdString="oUNHV_kbmY0";
$result = $mediaService->upload(array($video));
printf("Video id '%s' was "
.    "uploaded.\n",  $result[0]->mediaId);

But I don't understand why I'm getting this error :

Uncaught SoapFault exception: [soap:Server] [MediaError.UNSUPPORTED_TYPE @ media[0]]

Thanks for any help.

Youssef

Anthony Madrigal

unread,
Nov 24, 2015, 4:08:58 PM11/24/15
to AdWords API Forum
Hi Youssef,

The reason you are getting this error is because the upload method of the MediaService only supports Image and MediaBundle types. As a workaround, I suggest uploading your video through the AdWords UI, then use the API to obtain the media Id so that you can use it for the template ad. 

Cheers,
Anthony
AdWords API Team
Reply all
Reply to author
Forward
0 new messages