Reputation: 17
I am trying to change the playlist default name and description by adding the fields in playlist_updates.html, but I am unable to change it.
Here is the reference for the YouTube API: https://developers.google.com/youtube/v3/code_samples/javascript#create-a-playlist
Upvotes: 0
Views: 311
Reputation: 7666
You need to use the update API in order to update playlists.You need to get the playlist ID of the playlist (which you get from insert's results) and update it like this
var request = gapi.client.youtube.playlists.update({
part: 'id,snippet',
resource: {
id: '{insert playlist id here}',
snippet: {
title: 'New Playlist Title',
description: 'Well this is a new description hope you like it :)'
}
}
});
Then execute your request
request.execute(function(response) {
var result = response.result;
if(result){
alert('updated playlist id : '+ result.id + ' with title: '+ result.snippet.title + ' and description : ' + result.snippet.description);
} else {
alert('some error');
}
});
Upvotes: 1