Reverse sorting in API

I have been playing around with the MB API in order to create a simple app that will let the user favorite Labels and then see a list of the new releases from all their favorite labels. Conceptually, this is very simple but I’ve run into a problem with the MB API. I can get the list of releases for a label (using either browse or query) but it always returns them oldest to newest. So I have to page through it, which means I have to make multiple API calls. Since I have to rate limit to 1 call per second and I have to wait until all the API calls are completed in order to sort based on date descending, it takes quite a while for the list of new releases to load.

Is there a better way? It doesn’t seem like it’s possible to have the API sort descending or to have the API return a result set larger than 25 items. Any suggestions?

i don’t know how your api request look like. but in alot of cases you can just do limit=100 and then it will give you 100 items at once.

Thank you! That does help, but only by a factor of four. 100 seems to be a hard cap on the limit.

Here’s an example API call: https://musicbrainz.org/ws/2/release?label=89150667-0630-4d6d-9b57-b2e723323c5f&limit=100&offset=100

So in this example case, I have to page through 5 times which takes five seconds. And that’s just for one label. When I add a few labels that have been around for a while, it quickly gets to a minute of load time.

After first response you get the release count, so you can then directly offset to last page(s).

2 Likes