- If
/users/{username}is an alias of/users/{userId}(one cannot exist without the other) then I am expecting that deleting the former means that you want to delete the latter. - If
/lists/{listId}/users/{userId}is an reference to/users/{userId}(one can exist without the other) then I’m expecting to be able to delete the reference without affecting the canonical resource. - In both cases, invoking
HTTP GETwill result in HTTP 303 to the canonical resource.
I believe that it is confusing that both types behave the same for HTTP GET but not for HTTP DELETE.
This has led me to the following questions:
- What should happen when
HTTP DELETEis invoked on an alias? - What is the appropriate way to remove references from a list without removing the actual object they point to?
5.3.5. DELETE
**> A successful response SHOULD be 200 (OK) if the response includes a
So:
"both" resources must to be deleted. as i understand if one can not exist without other they are just different identifiers of same resource, so after deleting one of them following requests must be answered with 404 Not Found for both.
UPDATE:
If user(client?) would like to remove reference from a list without removing actual resource there is only one way – client must send PUT request with modified list to the server which means that existing list must be replaced with a new one. If user doesn’t have enough permissions "403 Forbidden" can be returned in response.
To do the reverse of this(i.e. inform user when list was changed) if resource(i.e. list in this case) is supposed to be cached on client side and removal of some other resource affects this list, only approach i can think to "inform" user is to use caches. For example:
REQUEST
RESPONSE
In the response above Cache-Control header value "private, max-age=0" is an instruction for client that it can cache representation locally though must send following request to the server each time:
REQUEST
if /list resource is untouched then ETag value will match "If-None-Match" value, server can respond with "304 Not Modified" and client doesn’t need to do anything. But if previous removal action affected the /list, hash code for ETag will be different from one which is provided with "If-None-Match" header and thus new representation of the /list resource will be returned by server.