Help - How to use Api to lookup album releases for an artist

Noob here, so sorry for asking stupid questions, but here goes!

I’m trying to work out how to query the musicbrainz api in order to get back a given artists main studio albums, much like you can see on the this page:

I know I can lookup the artist ID by using the artist endpoints:
http://musicbrainz.org/ws/2/artist/?query=radiohead&fmt=json

I can get from that query the artists “id” which I assumed I’d be able to use on the /release-group address. I couldn’t work out how I could use that ID on the other address :frowning:

Instead I thought I would just use the artist query on the release-group address to see what I got, like so:
http://musicbrainz.org/ws/2/release-group/?query=artist:radiohead&fmt=json

but I end up with a bunch of hits that are tribute/bootleg albums. Even then, they don’t look like studio/main releases and I’m not sure how to reduce the results to get that. I’ve tried to find API documentation and found this, which has given me clues but not answers: https://wiki.musicbrainz.org/Development/JSON_Web_Service

TL;DR
I’d like to be able to identify the artist and then use that ID to look up all studio releases.

Can anyone help me with this?

So first do a search for the artist, note that sometimes there are several artists with the same name so you may need to work out if you have the right one.

Once you have the artist id you want to run a query like the below to get the list of release groups:
http://musicbrainz.org/ws/2/artist/a74b1b7f-71a5-4011-9441-d0b5e4122711?inc=release-groups&fmt=json

You change what you include by using inc= parameters for example release-groups or url-rels etc.
See https://wiki.musicbrainz.org/Development/XML_Web_Service/Version_2

There is a “search” version of the api and a lookup api, you probably want to search for the artist and then use the artist id to look up more information.

2 Likes

how show more then 25 albums. I try add query limit=100 but don’t work here is my url i try fetch from react
const url = ${proxy}http://musicbrainz.org/ws/2/artist/${match.params.id}?inc=artist-credits+releases&fmt=json;

If you query the artist you won’t get more releases. From the API docs:

Note that the number of linked entities returned is always limited to 25, if you need the remaining results, you will have to perform a browse request.

You want to browse over the release resource instead:

https://musicbrainz.org/ws/2/release/?artist=10bf95b6-30e3-44f1-817f-45762cdc0de0&limit=100&fmt=json

3 Likes