How to request on foreign fields in webservice

Hi MetaBrainz

I’m requesting data from the ‘Place’ entity in the webservice call e.g
http://musicbrainz.org/ws/2/place/?query=test&fmt=json

Now, I would like to request on a particular eg. “type=studio”

Also I need to request on certain country codes eg. “US” OR “DK” OR “ETC.”

Can anyone please give me a hint how this can be done :slight_smile:

Best regards Christian

Hi Christian,

I’m afraid retrieving country codes cannot be done in one search request yet, see MBS-6741.

The only solution so far is to make additional lookup requests with inc=area-rels until retrieving area’s country.

For example, in your example request, your first result is the place Bikini Test the area of which is La Chaux-de-Fonds. Use its area MBID to make lookup request for parent area:

http://musicbrainz.org/ws/2/area/002bf72f-5226-4e3c-b29c-17fa48e36a74?inc=area-rels&fmt=json

Then, make a lookup request for the parent area Neuchâtel (with iso-3166-2 code CH-NE):

http://musicbrainz.org/ws/2/area/e1183381-0b89-4fd6-adfa-f33f2ece51bd?inc=area-rels&fmt=json

It returns every part of Neuchâtel and its parent area (type-id is "de7cc874-8b1b-3a05-8272-f3834c968fb7"and direction is "backward") Switzerland (with iso-3166-1 code CH).

2 Likes

@yvanzo thanks a lot :grinning:
one final question - what if I want to search for multiple type on the ‘place’ entity i cannot work it out
eg.
type=studio OR type=venue

on the following expression :

http://musicbrainz.org/ws/2/place/?query=test&fmt=json

please advice :sunny:

http://musicbrainz.org/ws/2/place/?query=test+AND+(type:venue+OR+type:other)&fmt=json

This is based on:

1 Like