mirror of
https://github.com/jwilsson/spotify-web-api-php.git
synced 2026-04-27 07:55:49 +03:00
[GH-ISSUE #115] Add track to playlist prepend (position 0) instead of append to end #69
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#69
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 25, 2018).
Original GitHub issue: https://github.com/jwilsson/spotify-web-api-php/issues/115
The Spotify API supports the optional position integer. I'd like to use it to add a new track as the first track of the playlist.
I'm not an PHP expert, so I'm wondering how I can reach this. I tried:
$api->addUserPlaylistTracks($me->id, $playlistId, '6sLY2CNublHBA0nsjnXvGR', ['position=0']);$api->addUserPlaylistTracks($me->id, $playlistId, '6sLY2CNublHBA0nsjnXvGR', ['\"position\": 0']);$api->addUserPlaylistTracks($me->id, $playlistId, ['59FjL5y7X8P8PmR8o9lmpi'],['\"position\": 0']);But none of it works. It seems that I can use the option array in your php code but probably I don't form the data well? There is no error thrown, the track just keeps being appended to the end of the list.
I hope you can help. Thank you in advance for your time.
@andersborgabiro commented on GitHub (Feb 26, 2018):
The syntax should be:
$api->addUserPlaylistTracks($me->id, $playlistId, ['someTrackId'], ['position' => 0]);
Whether it has the intended effect of prepending the track I don't know.
@jwilsson commented on GitHub (Feb 26, 2018):
Hi @kasperkamperman!
@andersborgabiro is absolutely correct, the syntax should be:
And this will prepend the track(s) as expected.