-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Response code 409 instead of 404 when PATCHing against nonexisting resource? #69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for submitting @maerlin. Tagging @garethj-msft and @darrelmiller for opinions |
I'm not sure why the decision was made to use 409 to indicate that no resource exists and the server can't create it. I would have expected a 404, personally. Maybe @cleemullins knows. I know sometimes people don't like returning 404 because they are concerned that it will mislead a developer into thinking some other part of the URL contains an error, rather than it being an unsupported operation. However, I don't think the choice of the API Guidelines is actually in violation of RFC 5789. It is quite reasonable to assume that try to patch a resource that does not exist "cannot be applied given the state of the resource". |
@darrelmiller Thank you for your thoughts !I would like to make a few further remarks. Part 1
If you patch a ressource, that does not exist, like this: Then it would be a part of the url containing an error, because the object with this guid does not exist. Part 2
But if you patch a path or property that does not exist, like in this example /notetitle should be /title:
In this case RFC 5789 mentions to return an 409. |
@maerlin I think both cases are debatable and regardless of which side of the debate that you are on, I don't think there are any significant negative side effects. I would prefer to see a 404 in the first case and a 409 in the second, but mostly likely we would need a payload to describe exactly where the conflict arose anyway, and it is easy to explain to the consumer what the problem in that description. Off the top of my head I can't imagine a case where my client would need to take different actions based on these two different status codes in this scenario. |
The guidline mentions this:
In the refered RFC 5789 there is this:
I think this should be clarified, and the following should be added (according to RFC 5789):
The text was updated successfully, but these errors were encountered: