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

Unable to remove tracks from playlist with Spotify Web API

Solved!

Unable to remove tracks from playlist with Spotify Web API

Plan

Premium

Country

Belgium

Device

MSI GS60 (Google Chrome with Web API and Web Playback SDK)

Operating System

Windows 10

 

My Question or Issue

Hi, I'm using the Spotify Web API and Spotify Web Playback SDK to create an app where I can basically sort my playlists .

  1. I use the "GET /v1/me/playlists" query to get all the user's playlists (with "fields" and "limit" parameters).
  2. I use the "GET /v1/playlists/{playlist_id}/tracks" query to get all the tracks from all the playlists (with the "fields", "limit" and "market" parameters to know if a track can be played through the Web Playback SDK with the is_playable property).
  3. I use the "DELETE /v1/playlists/{playlist_id}/tracks" command to remove the selected tracks from the playlist (I give the URIs I retrieved from the previous query).

When using the 3rd command, I receive an HTTP 200 response saying everything went fine but when I go to the Spotify App, the tracks are still there. When I remove the "market" parameter from the 2nd request, it works because the URIs have changed and are correct but I lose the "is_playable" property from the tracks so I can't know if a track can be played through the Web Playback SDK...

Is there a way to have both the "is_playable" information and have the ability to remove tracks ?

Thanks in advance. 

Reply

Accepted Solutions
Marked as solution

I understood my own mistake by simply reading the doc : https://developer.spotify.com/documentation/general/guides/track-relinking-guide/ ...

"IMPORTANT: If you plan to do further operations on tracks (for example, removing the track from a playlist or saving it to “Your Music”), it is important that you operate on the **original** track id found in the `linked_from` object. Using the ID of the linked track returned at the root level will likely return an error or other unexpected result."

So what I did is use the relinked URI instead of the URI from the track and now it works ! Thanks anyway !

View solution in original post

1 Reply
Marked as solution

I understood my own mistake by simply reading the doc : https://developer.spotify.com/documentation/general/guides/track-relinking-guide/ ...

"IMPORTANT: If you plan to do further operations on tracks (for example, removing the track from a playlist or saving it to “Your Music”), it is important that you operate on the **original** track id found in the `linked_from` object. Using the ID of the linked track returned at the root level will likely return an error or other unexpected result."

So what I did is use the relinked URI instead of the URI from the track and now it works ! Thanks anyway !

Suggested posts