GraphBrainz: GraphQL interface for MusicBrainz now supports custom extensions/integrations

musicbrainz
api
graphql
graphbrainz
Tags: #<Tag:0x00007f29ffca1518> #<Tag:0x00007f29ffca13d8> #<Tag:0x00007f29ffca1298> #<Tag:0x00007f29ffca1158>

#1

hey again folks,

I’m excited to announce a new feature I’ve been working on in GraphBrainz (an unofficial GraphQL interface for MusicBrainz). I just posted a prerelease containing a new Extension API, which allows developers to easily extend the GraphBrainz schema and integrate with whatever music-related services they want.

You can use this to add any number of fields to the existing MusicBrainz types, and those fields can pull in data from anywhere. GraphQL will then orchestrate all the fetching from multiple sources and give you a single query response. There are a few built-in extensions to give you an idea of what’s possible:

  • The MediaWiki extension finds URL relationships pointing to wiki image pages and retrieves the actual image file URL and properties like the title, description, license, etc.
  • The fanart.tv extension lets you retrieve various types of artwork.
  • TheAudioDB extension lets you retrieve biographies, images, ratings, music videos, etc.
  • Cover Art Archive support is now implemented as an extension.

This whole feature was prompted by my frustration with fetching artist images and such (like those that appear on the MB site) purely from MusicBrainz data. Even if an entity has a relationship with a URL of type “image”, it’s often a Wikimedia Commons page describing the image and not something you can put in <img src={…}> – that’s why I made the MediaWiki extension and will probably add a WikiData extension soon. Anyway, my frustration is to everyone’s benefit now. :slight_smile:

Here’s an example query using the new extensions: let’s get some Tom Petty images and a bio…

query TomPettyImages {
  lookup {
    artist(mbid: "5ca3f318-d028-4151-ac73-78e2b2d6cdcc") {
      name
      mediaWikiImages {
        url
        objectName
        descriptionHTML
        licenseShortName
      }
      fanArt {
        thumbnails {
          url
          likeCount
        }
      }
      theAudioDB {
        logo
        biography
      }
    }
  }
}

(see what happens when you run this query)

If you’re actually interested in any of this, let me know how I can help you try it out!


#2

Hey, was wondering: would you be interested in / willing to write a guest blog post about GraphBrainz? I think it might be interesting to have something more stable than a forum post to introduce the project :slight_smile:


#3

I’d be happy to! I’ve got contact info on my site if you’d like to get in touch via email. Let me know if you have any general goals for such a post and what level of detail you’re interested in.