User:LordSputnik/Web Service Persistent Templates

From MusicBrainz Wiki
< User:LordSputnik
Revision as of 21:52, 15 January 2013 by LordSputnik (talk | contribs) (Created page with "Persistent Data Templates The idea of this solution is to allow the user to specify exactly what results they’d like to receive. The user would submit some sort of empty dat...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Persistent Data Templates The idea of this solution is to allow the user to specify exactly what results they’d like to receive. The user would submit some sort of empty data template to the server for a particular entity. The server stores this data template. When the user requests any data about an entity, the server checks whether the user has submitted a template.

If a template’s been submitted, the server only fills out the required fields based on the template. It then sends the filled out version of the template back to the user, ensuring the user only gets the data they absolutely need.

Templates should remain active until reset by the user, or after some activity timeout.

I like this idea and maybe a contender for ws/3 Example 1

The user sends the following simple XML template to the server:

<metadata>
    <release>
        <title></title>
    </release>
</metadata>

The user then requests http://test.musicbrainz.org/release/0c64277d-0f63-3e49-92f7-8ae413faf46b


The server’s response would be:

<metadata>
    <release id="0c64277d-0f63-3e49-92f7-8ae413faf46b">
        <title>Sgt. Pepper’s Lonely Hearts Club Band</title>
    </release>
</metadata>

Which is much smaller than the current default response. Example 2 The user wants a very specific field in the release information. For example, original release date. Normally this would involve retrieving all of the information about the release group.

<metadata>
    <release>
        <release-group>
            <first-release-date></first-release-date>
        </release-group>
    </release>
</metadata>

For the same example release: http://test.musicbrainz.org/release/0c64277d-0f63-3e49-92f7-8ae413faf46b

This would generate the response:

<metadata>
    <release id="0c64277d-0f63-3e49-92f7-8ae413faf46b">
        <release-group type="Album" id="9f7a4c28-8fa2-3113-929c-c47a9f7982c3">
            <first-release-date>1967-06-01</first-release-date>
        </release-group>
    </release>
</metadata>