mirror of
https://github.com/jwilsson/spotify-web-api-php.git
synced 2026-04-27 16:05:51 +03:00
[GH-ISSUE #215] Paging when number of tracks returned by getPlaylist > 100 #150
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#150
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 @ghost on GitHub (Jan 3, 2021).
Original GitHub issue: https://github.com/jwilsson/spotify-web-api-php/issues/215
Hi Jonathan,
When using the
getPlaylistmethod, e.g. for playlist ID 6BcaB4qmXheLL2VWDO65h5, the default limit is that 100 tracks are returned in the API response from Spotify, unless alimitvalue is specified in the options. I'm calling the API like this, withlimitset to 10, andoffsetalso set to 10:Playlist ID 6BcaB4qmXheLL2VWDO65h5 contains 102 tracks, but the response from Spotify via the above call looks like this:
Here you can see:
hrefandnextvalues show the limit is set to 10The Spotify Docs say for Limit and Offset:
I wondered if I'm missing something obvious, or if it's not possible to paginate through the tracks?
Thanks
Jim
@jwilsson commented on GitHub (Jan 3, 2021):
Hi Jim!
Happy new year!
I think the method you're looking for is
getPlaylistTracks()which should be more efficient as well if you're only after the tracks. It accepts the same parameters asgetPlaylist().I do agree it's strange that
limitandoffsetis included in thehrefproperty.Cheers,
Jonathan
@ghost commented on GitHub (Jan 20, 2021):
Hi Jonathan - Happy Three Week Old Year to you :-)
Thanks for your helpful reply - I forgot to close this issue - your suggestion worked, to use 'getPlaylistTracks()'.
Excellent - thank you!
Jim