Return 205 "Reset Content" for a partial RESTful update?

Is 205 - Reset The content of the corresponding response code to return when a partial update was applied to the resource and the updated resource document is not returned in the response?

Updated: I am creating a web service that will support partial updates of the resource URL. One option is to return 200 along with an updated resource document. It seems that another option would be to return 205 - Reset Content without a body containing an updated view indicating that the client should initiate a GET of the resource. It seems like this would be consistent with returning a 201 w / Location header and without a body to create resources (which I am doing now to create resources).

+4
source share
2 answers

There is no reason to not just use status code 200.

+3
source

I still do not think your question explains what problem you are trying to solve, but here is my hunch 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 of partial updates as a template. You might want to consider dividing your resource into many smaller resources. This can simplify the development and understanding of the user API.

A2: 201 (β€œCreated”), as you mention in the commentary, should not be used as you are doing an update.

A3: 205 ("Reset Content") really doesn't sound completely wrong, because you want the client to invalidate their data, but the question is still - why? In addition, if only part of the client data has been updated on the server, you DO NOT want the client to abandon the entire view.

A4: If the client view becomes invalid after PUT, I would say that returning 303 ("See other") and setting the location header in the data URI is the right way, even if the URI has not been changed.

+2
source

Source: https://habr.com/ru/post/1403159/


All Articles