mirror of
https://github.com/jwilsson/spotify-web-api-php.git
synced 2026-04-26 23:45:49 +03:00
[GH-ISSUE #116] removing tracks at a certain position without passing a track id #67
Labels
No labels
bug
docs
enhancement
enhancement
enhancement
feedback wanted
good first issue
help wanted
help wanted
help wanted
invalid
pull-request
question
question
upstream
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/spotify-web-api-php#67
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @kasperkamperman on GitHub (Feb 27, 2018).
Original GitHub issue: https://github.com/jwilsson/spotify-web-api-php/issues/116
I'd like to remove tracks if my playlist is too long. According to the Spotify API this should be doable to only pass a positions array. However I get the idea that this isn't implemented. Although it also could be that my syntax is wrong.
https://developer.spotify.com/web-api/remove-tracks-playlist/
Paragraph: Removing the track at a given position in a specific playlist snapshot
First try:
This try will give the error:
Notice: Undefined index: id in /Applications/MAMP/htdocs/spotifyfm/src/SpotifyWebAPI.php on line 339 JSON body doesn't conform to specification
Second try:
This try will give the error:
Notice: Undefined index: id in /Applications/MAMP/htdocs/spotifyfm/src/SpotifyWebAPI.php on line 339
JSON body contains an invalid track uri: spotify:track:
@jwilsson commented on GitHub (Feb 27, 2018):
Hi!
It looks like we missed that case in
deleteUserPlaylistTracks(). Right now, the ID is always required but it should be made optional.Would you be interested in submitting a PR with a fix?
@kasperkamperman commented on GitHub (Feb 27, 2018):
I'm afraid I don't have enough knowledge of the inner workings to fix it.
I tried testing to comment the "id" lines in the deleteUserPlaylistTracks function, just to test. However I get the error "JSON body contains a track without URI". I also pass the snapshot_id which seems obligatory in this case.
I think this error is thrown by Spotify, so I don't know what is wrong now.
What I notice is that this specific implementation is not mentioned on the beta version of the developer site. So maybe this feature is removed?
https://beta.developer.spotify.com/documentation/web-api/reference/playlists/remove-tracks-playlist/
@jwilsson commented on GitHub (Feb 28, 2018):
@kasperkamperman No worries! I'll take a look at it, unless someone else beats me to it.
@kasperkamperman commented on GitHub (Mar 1, 2018):
Thanks for the fix!
@jwilsson commented on GitHub (Mar 1, 2018):
@kasperkamperman A fix for this has been released in
2.2.0. Something like this should work:Due note that the
$snapshotIdis required, but you can get it from a call togetUserPlaylist().