How do I delete a song in my library using the Spotify API?

Asked

Viewed 43 times

0

I have the following code:

   $.ajax({                     
                    //url: 'https://api.spotify.com/v1/me/tracks?ids=1ftBvRj542ol7LT1A0EtL7',
                    url: 'https://api.spotify.com/v1/me/tracks',
                    method:"delete",                        
                    scope: "user-library-modify",
                    headers: {
                        'Authorization': 'Bearer ' + access_token,
                        'Content-Type':'application/json'                           
                    },      
                    data:{'Id':'1ftBvRj542ol7LT1A0EtL7'},
                    json: true,                                             
                    success: function(response) {   
                        Console.log(response);
                        /*for(var k in response.items){
                            i += 1;
                            item.push('<li class="ui-state-default" id="m_'+response.items[k].track.id+'">'+response.items[k].track.name + '</li>');
                        }
                        item.push('</ul>');
                        //$('#teste')
                        //userProfilePlaceholder.innerHTML = userProfileTemplate(response);
                        userProfilePlaceholder.innerHTML = item.join("");
                        //console.log(userProfilePlaceholder);

                        */

                    }       
                });

But the parameter date is not correct:

    data:{'Id':'1ftBvRj542ol7LT1A0EtL7'},

For make the following mistake:

Erro

  • Try to change json: true for dataType: 'json'. Try to change too Id for id.

  • made the same mistake :(

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.