searchmusicbrainz

How to sort results from the MusicBrainz search API


I'm trying to retrieve track information from the MusicBrainz API, using only the artist and title as search queries:

http://musicbrainz.org/ws/2/recording/?query=artist:Coldplay+AND+recording:The+Scientist

This will return every version of the song that the artist released, including compilations, 'best of' albums and live recordings. I want to find the 'original' version, which should be the first one that was released.

Without retrieving every single result (which may not be possible in a single request) the obvious way to do this would be to have the response sorted by ascending release date, so that the first result is always the one I'm after.

The API documentation doesn't seem to mention sorting results, so is this possible?


Solution

  • I don't think sorting is possible.

    It may not solve all problems either. Many recordings have a date as a year only. Thus, a recording with release date "1989" will be considered an earlier version than a recording with release date "1989-01-01", which in reality may or may not be the case.

    Also, many releases have the same date, especially if the date is a year only, and some of these releases may be "original", while others are not. All recordings from these releases will have the same release date (e.g. "1989")

    If accuracy is important, you may have to find the earliest official release which is not marked as live or compilation, and then choose a recording from this release.