0
재생 목록에 동영상을 추가 할 수있는 웹 클라이언트를 만들려고합니다. 현재 나는 무엇이 잘못되었는지 아무런 단서도 없기 때문에 도움이 환영받는 것 이상입니다.YouTube 재생 목록 삽입 API Javascript
오류 코드 400()과 오류 코드가 표시되지만 비디오가 재생 목록에없는 것이 확실합니다. 그리고 똑같은 것은 "Try it!" 섹션. 그래서 내 설정 변수가 올바르지 않거나 잘못된 방식으로 보내고 있다고 생각합니다.
function addSongYTPlaylist(){
var xmlhttp = new XMLHttpRequest();
var url = "https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&part=snippet&key=AIzaSyA17v8PuNBsIwgbxg6D78iHV-w7_dYyXPw";
var config = {
"snippet": {
"playlistId": {PLAYLIST_ID},
"resourceId": {
"videoId": {VIDEO_ID},
"kind": "youtube#video"
}
}
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var response = JSON.parse(xmlhttp.responseText);
console.log(response);
}
};
console.log(url);
xmlhttp.open("POST", url, true);
xmlhttp.setRequestHeader("Authorization", "Bearer {ACCESS_TOKEN});
xmlhttp.send(config);
}