I am trying to create a playlist using the Spotify API and am receiving the following error:
{
"error" : {
"status" : 400,
"message" : "Error parsing JSON."
}
}
I am following the example on this page that says to use the following curl request
curl -X POST "https://api.spotify.com/v1/users/thelinmichael/playlists" -H "Authorization: Bearer {your access token}" -H "Content-Type: application/json" --data "{\"name\":\"A New Playlist\", \"public\":false}"
My code looks like this
$.ajax({
url: 'https://api.spotify.com/v1/users/{id}/playlists',
method: "POST",
data: {
name: "test"
},
headers: {
'Authorization': 'Bearer ' + access_token,
'Content-Type': 'application/json'
},
success: function(response) {
console.log(response);
}
});
Can anyone advise what I am doing wrong?