ここでは、作成したボタンで曲を追加するコードを示します。自分のプレイリストに曲を追加できるので、ボタンはうまく動作します。しかし、他の誰かのコラボレーティブプレイリストに曲を追加しようとすると、403の禁じられたエラーが発生します。403 Spotify Web Apiを使用して別のコラボレーティブプレイリストに曲を追加しようとしたときに禁止されたエラー
私は曲を追加しようとしているプレイリストに従っています。デスクトップアプリケーションでそのプレイリストに曲を追加できましたが、私のウェブページでは機能しません。コードにエラーがあるのか、APIが協力プレイリストに曲を追加できないのか分かりません。このプロジェクトの私のスコープはplaylist-read-private,playlist-modify-private,playlist-read-collaborative user-library-modify,user-read-private user-read-email
です。だから私は彼らも問題ではないと思う。
document.getElementById('button1').addEventListener('click', function() {
var myid=localStorage.getItem('SpotId')
var playid=localStorage.getItem('URI')
var trackuris = document.getElementById("selections").value;
console.log(trackuris)
var uris=[trackuris]; //create an array with the trackuri stored within
//adding track to playlist using myid, playid, and uris to fill function
spotifyApi.addTracksToPlaylist(myid,playid,uris).then(function(data) {
console.log('Added', data); //logging data returend from spotify to console
document.getElementById('list').src = document.getElementById('list').src;
var select = document.getElementById("selections");
$('#selections').empty(); //deletes previos entries upon adding song to playlist
});
});
ドキュメントをもう一度読んでください。これは本当です。どのように私が初めてそれを逃したのかわからないが、確かに彼らの最後に機能の失望の欠如です。彼らはすぐにこれを可能にするためにAPIを更新したいと考えています。 – McNamaras2