Looking up Individual Songs in MB API

Tags: #<Tag:0x00007f2a53adb4a0> #<Tag:0x00007f2a53adb360> #<Tag:0x00007f2a53adb1a8>

Hello, this might be a dumb question, but I have been having trouble looking up individual tracks in the API

For example, in the album https://musicbrainz.org/ws/2/release/a196aeab-db76-472d-8969-66422d3011ba?inc=aliases%2Bartist-credits%2Bdiscids%2Blabels%2Brecordings

I want to look up the song The Knife, which has the MBID 082583f9-0cda-4e43-b33d-39e6cc4c3c53. I can’t use the recording id because the MBID was what was available from Last.fm’s api. If I try to find it in https://musicbrainz.org/ws/2/recording/082583f9-0cda-4e43-b33d-39e6cc4c3c53, I get an invalid MBID warning.

Any help would be appreciated. Thanks!

2 Likes

Since what you have is a track ID not a recording ID you have to use a search query:

https://musicbrainz.org/ws/2/recording/?query=tid:082583f9-0cda-4e43-b33d-39e6cc4c3c53

This should always return at most one result since the track ID is unique.

4 Likes

//musicbrainz.org/track/082583f9-0cda-4e43-b33d-39e6cc4c3c53 is a track indeed.

In your xml you can get the recording MBID just few lines inside the <track>:

<track id="082583f9-0cda-4e43-b33d-39e6cc4c3c53">
	…
	<recording id="a0da0f08-5b68-470b-b6f7-23844db0054c">
		…
	</recording>
	…
</track>

//musicbrainz.org/recording/a0da0f08-5b68-470b-b6f7-23844db0054c is a recording.

2 Likes