1

I am trying to get an artist and their albums. So reading this page https://musicbrainz.org/doc/Development/XML_Web_Service/Version_2 i created the following query to get Michael Jackson's albums

http://musicbrainz.org/ws/2/artist/?query=artist:michael%20jackson?inc=releases+recordings

My understanding is to add ?inc=releases+recordings at the end of the URL which should return Michael Jackson's albums however this doesnt seem to return the correct results or i cant seem to narrow down the results? I then thought to use the {MBID} but again thats not returned in the artists query (which is why im trying to use inc in my query)

http://musicbrainz.org/ws/2/artist/?query=artist:michael%20jackson

Can anyone suggest where im going wrong with this?

Computer
  • 2,149
  • 7
  • 34
  • 71
  • 1
    https://musicbrainz.org/doc/Development/XML_Web_Service/Version_2#Introduction and https://musicbrainz.org/doc/Development/XML_Web_Service/Version_2#Lookups both say that what you're doing is a search which is documented at https://musicbrainz.org/doc/Development/XML_Web_Service/Version_2/Search and doesn't support inc arguments. – Wieland Jan 21 '15 at 09:22

1 Answers1

3

You're not searching for the correct Entity. What you want is to get the discography, not artist's infos. Additionally, query fields syntax is not correct (you must use Lucene Search Syntax).

Here is what you're looking for:

http://musicbrainz.org/ws/2/release-group/?query=artist:"michael jackson" AND primarytype:"album"

We're targeting the release-group entity to get the albums, searching for a specific artist and filtering the results to limit them to albums. (accepted values are: album, single, ep, other)

There are more options to fit your needs, for example you can filter the type of albums using the secondarytype parameter. Here is the query to retrieve only live albums:

http://musicbrainz.org/ws/2/release-group/?query=artist:"michael jackson" AND primarytype:"album" AND secondarytype="live"

Here is the doc: https://musicbrainz.org/doc/Development/XML_Web_Service/Version_2/Search

Note that to be able to use MB's API you need to understand how it is structured, especially, the relations between release_group, release and medium.

SuN
  • 1,036
  • 2
  • 12
  • 25
  • Thanks for that, just some clarification. How did you know type:1 is for albums? I cant find any reference to see how you knew that? Finally if i wanted to include MJ's date of birth i dont think its possible using 'release-group' so i thought to use 'AND begin' which didnt do the trick does this mean i would have to revert back to 'artist'? Or is there a way to include additional details (sorry but i think im missing something obvious here). Thx – Computer Jan 22 '15 at 18:32
  • I don't remember where I found this (I probably discovered that by myself playing with a dump some time ago), but you can directly put "album" if you prefer (looks like schema changed since I last used it, so I edited my answer). Here is the list of types and subtypes available: musicbrainz.org/doc/Release_Group/Type nb. don't forget to accept my answer if that's the query you were looking for. thx! – SuN Jan 23 '15 at 00:00