| A search that returns multiple types of resources is just retrieving a representation of a collection resource which can contain multiple types of resources. Canonical example: a typical web page resource is a collection of links to other pages, links to css files, links to js files, links to images, etc. Each item in the list is going to have a URI for the item, probably some text that briefly describes the item, and if necessary it can have a value that identifies the type of item. If I'm understanding correctly, your playlist resource is an ordered list of song identifiers, the song identifiers can appear more than once, and when you "delete a song" you're removing a single one of those identifiers. That sounds to me like an update of the playlist resource. The simplest model would be: GET /playlist/{playlist id}
... client modifies representation ...
PUT /playlist/{playlist id} That's not atomic and it puts some application-logic burden on the client, but you _are_ writing an API to allow others to develop full-featured clients, and maybe the burden also provides flexibility for operations you haven't thought of. Another approach would be for the representation of the playlist to include a unique id for each item in the list: your song id + index. You're not using a DELETE method here though, because you're not deleting a resource. You would use POST to update the playlist resource: POST /playlist/{playlist id}
operation=removeitem&songid={song id}&index={index} This is the general RESTful pattern for doing a partial update of a resource, so the client doesn't have to GET and PUT the complete resource. |