Announcements

Help Wizard

Step 1

NEXT STEP

FAQs

Please see below the most popular frequently asked questions.

Loading article...

Loading faqs...

VIEW ALL

Ongoing Issues

Please see below the current ongoing issues which are under investigation.

Loading issue...

Loading ongoing issues...

VIEW ALL

Can't remove specific tracks from playlist

Can't remove specific tracks from playlist

Plan

Premium

Country

USA

Device

API

Operating System

Latest MacOs

 

My Question or Issue

https://community.spotify.com/t5/Spotify-for-Developers/How-delete-one-or-more-elements-from-playlis...

 

In this previous thread it seems like t the remove tracks from playlist API supports removing certain positions. I can't seem to get this working with the positions parameter. Is this still supported? The docs have no mention of the positions param.

 

Docs for reference: https://developer.spotify.com/documentation/web-api/reference/remove-tracks-playlis

Reply
10 Replies

EDIT:

I figured out what my problem was:

Positions start at index 0, I was using the index displayed in the Spotify apps and getting an error.

Something to consider for anyone facing the same type of issue.

 

Hi,

did you find a solution for this problem?

I'm having the same issue 😞

It seems Spotify is doing silent API changes. Suddenly removing tracks at first positions gives an error. It happend two weeks ago, after that it started working, now it broke again...

 

My service is running for years and now it suddenly breaks. 

 

API documentation was removed around positions. You can remove tracks by id, but if you have duplicate track in the playlists all are remove (and I would like to remove specific positions). 

 

https://developer.spotify.com/documentation/web-api/reference/remove-tracks-playlist

 

See also:
https://github.com/jwilsson/spotify-web-api-php/issues/271

To be more specific, I now get the error: 

Missing or bad version tag

That's bad. Now you have to add back the tracks you want to keep with Add Items to Playlist. Left alone the extra code and memory needed to keep track of all track positions.

XimzendRising Star
Help others find this answer and click "Accept as Solution".
If you appreciate my answer, maybe give me a Like.
Note: I'm not a Spotify employee.

What worries me more is that Spotify has a developer community, but doesn't publish changes to their API. Let communicate actively. 

Other strange thing this happened 2 weeks ago suddenly, then it disappeared and now it's back. As if someone is using production server for development or something. 

I noticed the snapshotId that I get from addPlaylistTracks is really shorter then if I call deletePlaylistTracks. 

this one from addPlaylistTracks: AAn2GSGCVTwzpvrMt9xvB/Dma6/IZkkW
this one from deletePlaylistTracks: NjUyODI5LDEyYTg1NzRhOWFiNTJlODZkYmI2YzAxNTczM2JjODg3MzI1ZGI4NzQ=

My current workaround is calling deletePlaylistTracks twice. First to get the snapshotId then to call it with the snapshotId. 
Getting snapshotId by calling with empty tracks array is not documented either, but I figured this out playing with the web console. 

More details: 

https://github.com/jwilsson/spotify-web-api-php/issues/271#issuecomment-1995790688

The endpoint for removing tracks from a playlist is ignoring the previously supported "positions" field. This worked when using the previous version of the endpoint, DELETE https://api.spotify.com/v1/users/username/playlists/playlist-id/tracks, but that endpoint returns now a 403. Using DELETE https://api.spotify.com/v1/playlists/playlist-id/tracks works but ignores the positions, removing all appearances of a track in a playlist (see https://community.spotify.com/t5/Spotify-for-Developers/Positions-field-in-JSON-body-is-ignored-when-removing-tracks/m-p/6044424)

+1 to everyone. Been suffering too with these silent changes (or bugs?) over the last few weeks.

That string you got from the deletePlaylistTracks is also what I got yesterday (something like it, also base64 encoded) from the Update Playlist Items endpoint. But today, it started returning the snapshot ID again - but the whole endpoint just stopped working and instead returns just the input snapshot ID without making changes to the playlist. I think they are reworking or changing the whole snapshot system and we should probably expect changes to the API as well.

Welcome to the [Enshittification](https://en.wikipedia.org/wiki/Enshittification) stage of Spotify 😞 

Enshittification is the pattern of decreasing quality observed in online services and products.

Indeed my workaround worked for 1.5 month...

Suggested posts