Announcements

Help Wizard

Step 1

NEXT STEP

FAQs

Please see below the most popular frequently asked questions.

Loading article...

Loading faqs...

VIEW ALL

Ongoing Issues

Please see below the current ongoing issues which are under investigation.

Loading issue...

Loading ongoing issues...

VIEW ALL

Issues with /artists/albums

Solved!

Issues with /artists/albums

I'm having issues getting an artist's albums from the API.

 

Using the form at https://developer.spotify.com/documentation/web-api/reference/get-an-artists-albums 

I use the following values:

id = 7n2Ycct7Beij7Dj7meI4X0

limit = 50

 

The response says total is 71. But there are only 48 items in the response. (I know that valid albums are not included here.)

 

There is even a "next"-link in the response, with an offset of 50. But that doesn't work as the API only returns 48 albums.

 

The same issue exists for all other artists I tried with.

 

Anyone else having this issue?

Reply

Accepted Solutions
Marked as solution

Do you filter by album-type using include_groups in your request? Can you try to set include_groups=album in your request and check, which value for "total" is returned? After trying out a few things it seems to me, that Spotify limits the number of items in the response to the number of existing items with type "album", but only under some circumstances. I also think this is influenced by the given limit, e.g. for some artists I could reproduce the issue with limit=20 but not with limit=50.
Maybe a workaround could be first loading all items with include_groups=album, then all items with include_groups=single and so on, instead of combining these requests with include_groups=album,single,...

View solution in original post

4 Replies

Another thing I noticed, is that if I set the offset to 48, I get 4 items. But when I set the offset to 49, no items are returned.

Something is not right here...

Marked as solution

Do you filter by album-type using include_groups in your request? Can you try to set include_groups=album in your request and check, which value for "total" is returned? After trying out a few things it seems to me, that Spotify limits the number of items in the response to the number of existing items with type "album", but only under some circumstances. I also think this is influenced by the given limit, e.g. for some artists I could reproduce the issue with limit=20 but not with limit=50.
Maybe a workaround could be first loading all items with include_groups=album, then all items with include_groups=single and so on, instead of combining these requests with include_groups=album,single,...

This solution seems to work.  Odd that they are limited when you combine include_groups, I used limit 50.

I have the same issue, with a different example. There seems to be an issue with the offset when multiple `include_groups` are specified. I could make separate calls for each group, but then it will mean 3 round-trips to the server, which isn't good for anybody.

 

The example I'm looking at is.. 


{
"href": "https://api.spotify.com/v1/artists/2cBh5lVMg222FFuRU7EfDE/albums?include_groups=album,single,compila...",
"items": [],
"limit": 50,
"next": null,
"offset": 50,
"previous": "https://api.spotify.com/v1/artists/2cBh5lVMg222FFuRU7EfDE/albums?include_groups=album,single,compila...",
"total": 58
}

So I'm providing an offset of 50, and a limit of 50. The total states that there are 58 records available (which is correct 45 singles and 13 albums), so I'd expect to see 8 albums/singles listed in the `items` element.

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