I use youtube API to update video on youtube.The problem is that i got this error from youtube when i want to update the video publishAt status.
[2017-11-29 12:19:39] local.ERROR: Google_Service_Exception: {"error": {"errors": [ {"domain": "youtube.video","reason": "invalidVideoMetadata","message": "The request metadata is invalid.","locationType": "other","location": "body" } ],"code": 400,"message": "The request metadata is invalid." }}But the strange thing is that i get the error only if i set the publishAt value (ive updated the privacyStatus to 'private'). If the publishAt is null the update process is successful.
$params = array();$part = 'snippet,contentDetails,player,status'; $properties = ['snippet.categoryId' => $this->video->youtube_category_id,'snippet.defaultLanguage' => '','snippet.description' => $this->video->video_description,'snippet.tags[]' => !empty($this->video->tags->pluck('tag_value')->toArray())?implode(',',$this->video->tags->pluck('tag_value')->toArray()):'','snippet.title' => $this->video->video_title,'status.embeddable' => true,'status.license' => '','status.privacyStatus' => !empty($this->video->privacy_status) ? $this->video->privacy_status : 'private','status.publishAt' => empty($this->video->video_release_date) ? "" : date('Y-m-d\TH:i:s.sP',strtotime($this->video->video_release_date)),'status.publicStatsViewable' => ''];if(!empty($this->video->youtube_id)){ $properties['id'] = $this->video->youtube_id;}$service = new \Google_Service_YouTube($client);$propertyObject = $this->createResource($properties);$resource = new \Google_Service_YouTube_Video($propertyObject);if($this->upload) $client->setDefer(true);if(!empty($this->video->youtube_id)){ $request = $service->videos->update($part, $resource, $params);}elseif($this->upload) { $request = $service->videos->insert($part, $resource, $params);}else{ exit;}ive search the internet about this problem but didnt found any solution. Please help thanks.
Note: using this code, upload video is successful.