spotify / web-api

This issue tracker is no longer used. Join us in the Spotify for Developers forum for support with the Spotify Web API ➡️ https://community.spotify.com/t5/Spotify-for-Developers/bd-p/Spotify_Developer
981 stars 79 forks source link

Spotify API - get all of user's Liked Songs? #1321

Open jeffreybloemen opened 5 years ago

jeffreybloemen commented 5 years ago

Hi all,

I am looking to build an app which uses all of an user's Liked Songs as input (https://developer.spotify.com/documentation/web-api/reference/library/get-users-saved-tracks/). However, the limit appears to be 50 max:

limit Optional. The maximum number of objects to return. Default: 20. Minimum: 1. Maximum: 50.

Is there any way to get all of a user's songs?

Kind regards

jscholes commented 5 years ago

Look at the next row in the Query Parameters table. You'll see:

offset | Optional. The index of the first object to return. Default: 0 (i.e., the first object). Use with limit to get the next set of objects.

This is how the Spotify Web API implements pagination, allowing you to retrieve up to 10,000 saved tracks (which is also the limit that a user can save in the first place). Saved tracks and liked tracks might not be the same thing, though.

jeffreybloemen commented 5 years ago

Look at the next row in the Query Parameters table. You'll see:

offset | Optional. The index of the first object to return. Default: 0 (i.e., the first object). Use with limit to get the next set of objects.

This is how the Spotify Web API implements pagination, allowing you to retrieve up to 10,000 saved tracks (which is also the limit that a user can save in the first place). Saved tracks and liked tracks might not be the same thing, though.

Thanks jscholes.

Question: why is it done this way, as opposed to just having a limit of 10,000 (not needing to offset)?

0xNF commented 5 years ago

Bandwidth costs.