Announcements

Help Wizard

Step 1

NEXT STEP

Pagination does not work on /v1/artists/{id}/albums

Pagination does not work on /v1/artists/{id}/albums

Initially, I tried to make paginated requests for this endpoint from my application. But I found that even with enough total, I get an empty list of items. as far as I understand, if the offset is less than the total, then everything should work.

 

As I checked, this does not work for all authors and markets.

 

For example: https://api.spotify.com/v1/artists/0TnOYISbd1XYRBk9myaseg/albums?include_groups=single%2Cappears_on&...

 

Reply
3 Replies

I have the same problem.

I use spotify tools : 

souriya59_1-1709059618644.png

In my browser's console :

souriya59_0-1709059579841.png

No results in ITEMS



 

I managed to get around this problem by doing separate requests for each of the album types (ie 'album', 'single', 'appears_on' and 'compilation')

For some reason, when I am only using 1 album type the problem of having empty pages does not arise. I then collate the responses into 1 dataset.

 

Python example:

 

albums = []
for album_type in ['album', 'single', 'appears_on', 'compilation']:
page = self.spotify_client.artist_albums(artist_id, limit=50, album_type=album_type)
while page:
albums.extend(page["items"])
page = self.spotify_client.next(page)

 I hope this helps someone because I struggled with it for a long time and it seems to have been an issue for many years. 

You legend. I was having the same issue but this workaround solved it.

Suggested posts

Let's introduce ourselves!

Hey there you,   Yeah, you! 😁   Welcome - we're glad you joined the Spotify Community!   While you here, let's have a fun game and get…

ModeratorStaff / Moderator/ 4 years ago  in Social & Random