I am uploading a video to Youtube and then attempting to add it to a playlist. The playlist insert is failing in a weird way. Here is my code:
var options = {
'part' : 'snippet',
'snippet' : {
'playlistId' : playlistId,
'resourceId' : {
'kind' : 'youtube#video',
'videoId' : videoId
}
},
status : {
privacyStatus : 'unlisted'
}
};
console.log('options : ' + JSON.stringify(options));
youtube.playlistItems.insert(options, function(listErr, listResponse){
console.log(JSON.stringify(listErr));
console.log(JSON.stringify(listResponse));
});
I always get the exact same response:
{"errors":[{"domain":"youtube.playlistItem","reason":"playlistIdRequired","message":"Playlist id not specified."}],"code":400,"message":"Playlist id not specified."}
Anyone have any idea what I'm doing wrong? Any help will be much appreciated. I'm using googleapi Node.js sdk.