Search code examples
musicbrainz

Album mbId in track's metadata


I am using MusicBrainz to get a track's meta data. I want to get the track's album's mbid. I am doing the following lookup using ISRC code.

https://musicbrainz.org/ws/2/isrc/USRC11600201?fmt=json

But in response I don't get any metadata related to the album of the track. I get the following response:

{ "isrc": "USRC11600201", "recordings": [ { "disambiguation": "single remix", "title": "Cheap Thrills", "id": "92e27a47-3546-4bc2-a9f7-b19e43d7a531", "length": 223000, "video": false }, { "length": 218540, "video": false, "title": "Cheap Thrills", "disambiguation": "", "id": "5845e975-33b4-4b0d-8e74-8f57d128b3d1" } ] }

I have tried various combinations of the "inc" sub query parameter as well but nothing works. Please help me out. I am really stuck at this.


Solution

  • Using inc=releases in the URL parameters should be enough to get you the information that you want. However, it seems like there's a bug with MusicBrainz's JSON web service (which is still officially in beta), as you can see in the difference between the XML and JSON end points' output: https://musicbrainz.org/ws/2/isrc/USRC11600201?inc=releases&fmt=json (JSON) vs. https://musicbrainz.org/ws/2/isrc/USRC11600201?inc=releases (XML).

    One obvious solution/work-around here would be to switch to using the more mature XML endpoint. If that is not an option, you can use the Recording MBIDs given in the JSON output to look up releases associated with those Recordings, e.g., https://musicbrainz.org/ws/2/recording/5845e975-33b4-4b0d-8e74-8f57d128b3d1?inc=releases&fmt=json (note that inc=releases is also needed here to get the information about the releases, and it actually works when looking up recordings).