[GH-ISSUE #199] Exception removing a track from a playlist #137

Closed
opened 2026-02-27 19:26:15 +03:00 by kerem · 2 comments
Owner

Originally created by @tobyink on GitHub (Jul 28, 2020).
Original GitHub issue: https://github.com/jwilsson/spotify-web-api-php/issues/199

I'm getting the following, which I guess is maybe an error in the Spotify API itself rather than this library, but who knows?

PHP Fatal error:  Uncaught SpotifyWebAPI\\SpotifyWebAPIException: JSON body doesn't conform to specification

This is thrown when I execute the following to delete a single track:

$api->deletePlaylistTracks( playlist_id, [ 'tracks' => [ $track_id ] ] );
Originally created by @tobyink on GitHub (Jul 28, 2020). Original GitHub issue: https://github.com/jwilsson/spotify-web-api-php/issues/199 I'm getting the following, which I guess is maybe an error in the Spotify API itself rather than this library, but who knows? ``` PHP Fatal error: Uncaught SpotifyWebAPI\\SpotifyWebAPIException: JSON body doesn't conform to specification ``` This is thrown when I execute the following to delete a single track: ``` $api->deletePlaylistTracks( playlist_id, [ 'tracks' => [ $track_id ] ] ); ```
kerem closed this issue 2026-02-27 19:26:15 +03:00
Author
Owner

@jwilsson commented on GitHub (Jul 29, 2020):

Hey!
It seems the id key is missing in the tracks array. This should work:

$api->deletePlaylistTracks( playlist_id, [ 'tracks' => [ 'id' => $track_id ] ] );
<!-- gh-comment-id:665451364 --> @jwilsson commented on GitHub (Jul 29, 2020): Hey! It seems the `id` key is missing in the `tracks` array. This should work: ```php $api->deletePlaylistTracks( playlist_id, [ 'tracks' => [ 'id' => $track_id ] ] ); ```
Author
Owner

@tobyink commented on GitHub (Jul 29, 2020):

My bad! I misinterpreted the documentation for that method and hadn't even checked the example.

Works great now. Thanks!

<!-- gh-comment-id:665644051 --> @tobyink commented on GitHub (Jul 29, 2020): My bad! I misinterpreted the documentation for that method and hadn't even checked the example. Works great now. Thanks!
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/spotify-web-api-php#137
No description provided.