Closed alexweinstein closed 1 year ago
bump
Hey, I'm not SC, but no, they don't have offset based pagination anymore.
AFAIK, their API a long time ago used to have offset paging on some of the really old APIs but they all got deprecated in favour of cursor based pagination.
The issue will be with their large distributed data stores that don't lend themselves to offset based pagination (issues with distributed sharding, inconsistent results, and issues with getting a "total" count which you need for pages), so it simply isn't an option anymore unfortunately.
In your specific use case you describe above, you can work out the number of "pages" because the user object has a track_count
and private_tracks_count
. However, when it comes to loading page 3, as per your example, you will need to traverse the pages, and make 3 API calls in turn.
@mgoodfellow Got it. Thanks so much for jumping in. I appreciate it.
Following the Soundcloud API documentation, when getting
/tracks
or/playlists
we set thelinked_partitioning
parameter totrue
and check fornext_href
on the return. Ifnext_href
exists, follow that url for the next set of data.This makes sense for an endless scroll.
But is it possible to send the user to a specific page of results? For example, a URL for Page 3 of a user's tracks when
limit
is set to 200? Or is this just not possible withlinked_partitioning
? Is there any other way to get this type of pagination with Soundcloud API?