Youtube api v3更新状态为publishAt的视频

时间:2016-10-20 07:31:40

标签: php laravel-5 youtube youtube-api youtube-data-api

我正在尝试使用消息return 400

设置status.publishAt The request metadata is invalid

这是我的代码:

$videos = $youtube->videos->listVideos('id,snippet,status', array(
  'id' => $videoId,
));

$updateVideo = $videos[0];
$date = "2016-10-20T20:00:00.00+00:00";

$updateVideo['status']['embeddable'] = true;
$updateVideo['status']['privacyStatus'] = 'private';
$updateVideo['status']['publicStatsViewable'] =true;
$updateVideo['status']['publishAt'] = $date;
$videoUpdateResponse = $youtube->videos->update('id,snippet,status', $updateVideo);
dd($videoUpdateResponse);
exit();

哪里错了?请帮我!感谢

1 个答案:

答案 0 :(得分:1)

From Ibrahim Ulukaya's answer he is one of the developer of youtube api.

To change a field in upload method, you have to put all other fields you get, otherwise the update method will think you are trying to empty them.

In your case, you should include "license" and "publicStatsViewable" in your PUT request just as you get them from your "GET" request.