Site Home / Forum / Developers / Extract label data from the API
Extract label data from the API
Posted: 25 May 2022 05:13
isilviu Posts: 1 Joined: 2022-05-25
Hi,
I have searched through the API documentation and could not find a way to fetch record label data.
Will this option be added to the API?
Thank you.
Posted: 21 Aug 2022 02:45
codejp3 Posts: 7 Joined: 2022-08-17
I'm not the API developer, just another user like you.
From getting familiar with the results for queries, 2 fields exist for Label:
idLabel
strLabel
As far I know, there's no TADB API endpoint to query for these, but could be added down the road.
In the meantime, you could use the MusicBrainzAPI. The query endpoint for labels is:
https://musicbrainz.org/ws/2/label/?query=
The idLabel is specific to TADB and won't do you any good on M.B., but you could try to query the strLabel value.
I'm going to use the example label name "Nuclear Blast" as the strLabel value returned from a TADB artist lookup.
The label name needs to be URL-friendly, so format it with rawurlencode (PHP) or similar function for whatever language your coding in. Since it's more than one word, it needs to encased in double quotes (""). The result for that would be:
%22nuclear%20blast%22
Then just append that to url query parameter:
https://musicbrainz.org/ws/2/label/?query=%22nuclear%20blast%22
That will give you a ton of info about the label, including the specific MBID for that label. In this example it's:
3bc70925-d654-4906-b7c0-5135d993495e
You may be able to get the info you're looking from that. BUT, If you want releases from that label, you can use the label MBID to query releases:
https://musicbrainz.org/ws/2/label/3bc70925-d654-4906-b7c0-5135d993495e?inc=releases
NOTE: MusicBrainz greatly limits the time a query can run, so a label may have 1,000+ releases, but you'll only get as many as it could process before the query times out. Your best bet is to know what you're looking for, and search specifically for that instead of a generic "give me all releases from this label".
API info:
https://musicbrainz.org/doc/MusicBrainz_API