Using API to get Twitter usernames

Trying to lookup twitter usernames, but can’t seem to find the string. I’m using the node library - can anyone help? I’ve tried:

mb.lookupArtist(id, ['social networking'], function (error, data) {
        console.log(JSON.stringify(data));
    });

also tried ‘relationships’, ‘social-networking’ etc etc

I have no idea about the node library you’re using but I’m looking at the JSON response for the artist I’m currently listening to and the twitter url is under the social networking type but it’s no good as it would return results for facebook, instagram etc. I think you’ll have to use filter and startsWith("https://twitter.com")

1 Like

You need to use the inc=url-rels parameter, e.g.

https://musicbrainz.org/ws/2/artist/10bf95b6-30e3-44f1-817f-45762cdc0de0?inc=url-rels&fmt=json

How exactly this translates to the node API you have to lookup in their documentation, but probably it is just passing ['url-rels'] as the second parameter. The possible values for inc are documented at https://musicbrainz.org/doc/Development/XML_Web_Service/Version_2

1 Like