Development / ws / js

This page has not been reviewed by our documentation team (more info).

NOTE: the /ws/js webservice is considered to be part of the musicbrainz server code. it isn't version and may change at any time, please do not rely on it for anything important, use /ws/2 instead. (also note that the documentation here is currently incomplete and outdated).

Autocomplete

Currently there is an autocomplete interface for artists and labels. A request looks like this:

 /ws/js/artist?q=cycles&limit=3&page=1
 /ws/js/label?q=warp+records

The services provide a JSON formatted response which contains a list of search results. The final entry of the list is not a search result, but information about the search itself, so pop this off the list if you're only interested in the results themselves.

A response looks like this:

[
   {
       "comment": null, 
       "gid": "3c4524ce-dc16-4dbd-b52f-6e7f9f067f9a", 
       "name": "7 Cycles", 
       "id": "556345"
   }, 
   {
       "comment": "UK Based Electronica Producer Oliver Charles", 
       "gid": "d3423ede-83ba-4758-8e4c-4f0d5f0bfabd", 
       "name": "Cycles", 
       "id": "592771"
   }, 
   {
       "comment": null, 
       "gid": "8847a88f-5780-4224-b879-8dc15ce153a0", 
       "name": "Pharmakustik + Frequency in Cycles Per Second", 
       "id": "650671"
   }, 
   {
       "current": "1", 
       "pages": 2
   }
]

NOTE: there is also a separate recording autocomplete lookup, but this isn't documented yet as it is scheduled to undergo some changes to share more code with the label/artist lookups.

Tracklist

The javascript webservice provides access to tracklists, this is mainly intended to lazy load them in the release editor. Simply provide the tracklist row id in a call to /ws/js/tracklist:

 /ws/js/tracklist/184453

The response will be a list of tracks with artist credits, as an example the response to the above request is:

[
   {
       "length": "6:11", 
       "name": "Glenn", 
       "artist_credit": {
           "preview": "Slint", 
           "names": [
               {
                   "gid": "2869c510-2679-4a3f-bf15-e5e8b49f2f28", 
                   "join": null, 
                   "name": "Slint", 
                   "artist_name": "Slint"
               }
           ]
       }
   }, 
   {
       "length": "6:54", 
       "name": "Rhoda", 
       "artist_credit": {
           "preview": "Slint", 
           "names": [
               {
                   "gid": "2869c510-2679-4a3f-bf15-e5e8b49f2f28", 
                   "join": null, 
                   "name": "Slint", 
                   "artist_name": "Slint"
               }
           ]
       }
   }
]