[GH-ISSUE #17] user_playlist_add_track error #5

Closed
opened 2026-02-27 23:20:21 +03:00 by kerem · 1 comment
Owner

Originally created by @kevlu93 on GitHub (Jul 24, 2014).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/17

Hey I'm just starting to get familiar with the api, and I'm just trying out a simple task. I'm trying to add the top 3 tracks of a given artist to a playlist.

I know authentication worked because I can access the playlists, and I set my scope to playlist-modify-private and public.

I use the following command:

sp.user_playlist_add_tracks(user, playlist_id, song['uri'])

This is the value of song['uri']:

song_uri
Out[20]: u'spotify:track:2Zb7wnGUnNPCas2E0wWSQ5'

Here's the error message:

http status: 400, code:-1 - the requested resource could not be found: https://api.spotify.com/v1/users/121142162/playlists/3LhmfLB345HX1tty3Z99u7/tracks?uris=s%2Cp%2Co%2Ct%2Ci%2Cf%2Cy%2C%3A%2Ct%2Cr%2Ca%2Cc%2Ck%2C%3A%2C2%2CZ%2Cb%2C7%2Cw%2Cn%2CG%2CU%2Cn%2CN%2CP%2CC%2Ca%2Cs%2C2%2CE%2C0%2Cw%2CW%2CS%2CQ%2C5

It seems like the uri's match up, ignoring how colons were decoded. Any ideas what the issue is?

Originally created by @kevlu93 on GitHub (Jul 24, 2014). Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/17 Hey I'm just starting to get familiar with the api, and I'm just trying out a simple task. I'm trying to add the top 3 tracks of a given artist to a playlist. I know authentication worked because I can access the playlists, and I set my scope to playlist-modify-private and public. I use the following command: sp.user_playlist_add_tracks(user, playlist_id, song['uri']) This is the value of song['uri']: song_uri Out[20]: u'spotify:track:2Zb7wnGUnNPCas2E0wWSQ5' Here's the error message: http status: 400, code:-1 - the requested resource could not be found: https://api.spotify.com/v1/users/121142162/playlists/3LhmfLB345HX1tty3Z99u7/tracks?uris=s%2Cp%2Co%2Ct%2Ci%2Cf%2Cy%2C%3A%2Ct%2Cr%2Ca%2Cc%2Ck%2C%3A%2C2%2CZ%2Cb%2C7%2Cw%2Cn%2CG%2CU%2Cn%2CN%2CP%2CC%2Ca%2Cs%2C2%2CE%2C0%2Cw%2CW%2CS%2CQ%2C5 It seems like the uri's match up, ignoring how colons were decoded. Any ideas what the issue is?
kerem closed this issue 2026-02-27 23:20:21 +03:00
Author
Owner

@dansinclair25 commented on GitHub (Aug 31, 2016):

song['uri'] needs to be a list.

Note the method is user_playlist_add_tracks() (tracks being plural).

Just wrap the track in brackets:
sp.user_playlist_add_tracks(user, playlist_id, [song['uri']])

<!-- gh-comment-id:243711413 --> @dansinclair25 commented on GitHub (Aug 31, 2016): `song['uri']` needs to be a list. Note the method is `user_playlist_add_tracks()` (**tracks** being plural). Just wrap the track in brackets: `sp.user_playlist_add_tracks(user, playlist_id, [song['uri']])`
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotipy#5
No description provided.