Reputation: 9241
Is 205 - Reset Content the appropriate response code to return when a partial update has been applied to a resource and the updated resource document isn't returned in the response?
Updated: I'm creating a web service that will support partial updates to the URL of the resource. One option is to return a 200 along with an updated resource document. It seems like another option may be to return 205 - Reset Content without a body containing an updated representation indicating that the client should initiate a GET of the resource. It seems that this would be consistent with returning 201 w/ a Location header and no body for resource creation (which is what I'm currently doing for resource creation).
Upvotes: 4
Views: 2896
Reputation: 3586
I still do not find that your question explains what problem you are trying to solve but here is my guess and my answer:
Q: You want to have a resource that the caller can update by sending PUT /myResource but for some reason, you do not want the whole resource to be updated, only to some extent(?).
A1: I have not heard about partial updates as a pattern. You might want to consider splitting your resource into many smaller resources. That might make things easier to develop and for the user of the API to understand.
A2: 201 ("Created") as you mention in a comment should not be used since you are doing an update.
A3: 205 ("Reset Content") does actually not sound totally wrong, since you want the client to invalidate its data but the question is still - why? Also, if only part of the client's data was updated on the server, you do NOT want the client to drop the whole representation.
A4: If the client representation becomes invalid after the PUT, I would say that returning 303 ("See Other") and setting the Location header to the URI of the data is the right way to go, even if the URI has not changed.
Upvotes: 2