Announcements

Help Wizard

Step 1

NEXT STEP

Add Tracks to Playlist Changed ; No URIs Provided error

Add Tracks to Playlist Changed ; No URIs Provided error

Did the API change the functionality of adding tracks to a playlist? I have my code load in TrackIds and use them to add tracks to a playlist but just today I got an error saying that I did not provide any URIs. Did something change in the backend that no longer will allow me to provide TrackIds instead of URIs?

 

I am using the spotipy Python package and another user commented below that their own web app has this same issue.

 

Error code 400: No uris provided., reason: None

 

 

ISSUE RESOLVED: My python code using spotipy now works as expected and the function playlist_add_items works perfect now. Thank you to whoever made this correction.

Reply
10 Replies

The documentation says you should provide track/item URIs for years.

Hi Spotify,

 

issue

  • i have a spotify based web app that has been online for 2.75 years that allow users to copy tracks from one playlist to another and it has worked fine up until today.
  • the web app copy feature is now getting an   Error:  400 "No uris provided."

 

here is an example for adding 1 track to a playlist

method = POST

url = 'https://api.spotify.com/v1/playlists/1n2STXHae0Wg6ZV0OYwToy/tracks'

data = '["spotify:track:5G4JTc4HlIsg7CyiDwoPV2"]'

  •  this spotify web api call now returns an error:  400  "No uris provided."
  •  this spotify web api call has worked for the last 2.75 years but is now failing
  • my code has not changed and the above example worked a few days ago
  • thinking the spotify server code has changes

 

questions
- is this a known issue that is being worked on?

- do i need to change my code?

- is there anything i can do to help sort this out?

 

Thanks,

Louie

 

 

 

 

The request body should be:

{

    "uris": [

        "uri1","uri2","urietc"

    ],

    "position": 0

}

 

Like it is documented at https://developer.spotify.com/documentation/web-api/reference/add-tracks-to-playlist

It must be an error on the Spotify side. I am using the Python package spotipy and wasn't sure if it was an issue there or in the backend. Hoping Spotify will address this issue shortly.

-yep i agree that is what the docs say.

-i have been using the spotipy web api wrapper for 2.75 years to add tracks to another playlist.

-it worked fine a few days ago

-my code has not changed

-today when i attempt to add a track to another playlist i now get Error:  400 "No uris provided."

-it seems to me that spotify has changed the code on the server

-was this change intentional?

-if this was intentional it seems like the v1 in the url would need to be bumped to v1+ because a change like this will break a lot of spotipy user apps

 

 

@slipstream422 there was a deprecation warning in Spotipy since at least version 2.22.1 of January 23, 2023 and did not accept track IDs since December 16, 2023. Source1Source2

 

I tested to add a track with its URI to a playlist with Spotipy, and it just worked.

 

@Ximzend excellent it is working. thanks for testing the spotipy api.

 

a couple of questions:

1) what version of the spotipy pkg did you use.

2) can you paste an example of the 'items' param you passed into spotipy: playlist_add_items(self, playlist_id, items, position=None)

 

fyi...i had to modify spotipy: playlist_add_items() to stop getting the Error:  400 "No uris provided."

see modified code in a later post

 

btw... if you are interested you might google spotifyfinder.com to have a look at the web app...

         the move and copy features are currently busted.

 

Thanks,

Louie

Have same problem today, i'm using spotipy and 

user_playlist_add_tracks stopped working with 
spotipy.exceptions.SpotifyException: http status: 400, code:-1 - https://api.spotify.com/v1/playlists/37i9dQZF1E36UCcYuaeLMW/tracks:
No uris provided., reason: None

the spotify server appears to no longer accept
items = ['spotify:track:6HG5MFydepB9F8DAP0ejDD', 'spotify:track:3yQ4dy23XekcMsdeaBXZR6']

if you do this you get Error:  400 "No uris provided."

 

you must now pass in
items = {'uris': ['spotify:track:6HG5MFydepB9F8DAP0ejDD', 'spotify:track:3yQ4dy23XekcMsdeaBXZR6']}

if you do this it works fine

 

 

 

- had to modify spotipy: playlist_add_items() to make it work
- use the passed in items param directly
def playlist_add_items(elf, playlist_id, items, position=None):
    plid = self._get_id("playlist", playlist_id)
    # ftracks = [self._get_uri("track", tid) for tid in items]
    ftracks = items
    return self._post(
        "playlists/%s/tracks" % (plid),
        payload=ftracks,
        # position=position)

 

 

 

i wonder if spotify knows they broke spotipy?

both spotipy 2.22.1 and spotipy 2.23.0 are broken

It looks like Spotify fixed the issue overnight. The python program works as expected now with no issues using the function playlist_add_items. Thank you!

Suggested posts