-
Bug
-
Resolution: Fixed
-
Normal
-
None
-
None
The behaviour of collection queries via the webservice is confusion and broken.
At present, any request ending /ws/2/collection returns a collection-list element containing the collections for the currently authenticated user, e.g.,
http://test.musicbrainz.org/ws/2/collection/foobar
returns:
<metadata>
<collection-list>
<collection id="79e457fc-2a99-4a7f-a557-76b9d1ef3a3e">
<name>Collection 2</name>
<editor>cjk32</editor>
<release-list count="1"/>
</collection>
<collection id="ae18570f-c4f9-4fb9-84a5-6f18b811a60d">
<name>Collection 1</name>
<editor>cjk32</editor>
<release-list count="0"/>
</collection>
</collection-list>
</metadata>
This is confusing, and entirely inconsistent with the behaviour for other entities.
To regain consistency with the behaviour for other entities, it should firstly be possible to lookup a single collection via its id. Thus a request for,
.../ws/2/collection/ae18570f-c4f9-4fb9-84a5-6f18b811a60d
should return something like:
<metadata>
<collection id="ae18570f-c4f9-4fb9-84a5-6f18b811a60d">
<name>Collection 1</name>
<editor>cjk32</editor>
<release-list count="0"/>
</collection>
</metadata>
and not simply a complete collection-list as above.
It should also be possible to issue a browse request that does return a collection-list (with data as above). For consistency with other browse requests, I would recommend something like:
.../ws/2/collection?editor=<...>
Any request for a editor other than the current authenticated username would return an http 401 status. It might also be useful to have a 'magic' user value that would indicate that the currently authenticated user should be used.
Finally, there's currently no way to get the content of the release-list for a collection. Adding inc=releases could be used to cause this information to be returned. Alternatively, and probably preferably as release-list is likely to be large (and thus it would probably be desirable to be able to page through the releases), it should be possible to use a browse request, e.g.:
.../ws/2/release?collection=79e457fc-2a99-4a7f-a557-76b9d1ef3a3e