4 ms·
In one of my projects I started returning 409 Conflict for the former case here. Its description seems to match this use case: > The request could not be comp
by tiglionabbit 11y ago
In one of my projects I started returning 409 Conflict for the former case here. Its description seems to match this use case:
> The request could not be completed due to a conflict with the current state of the resource. This code is only allowed in situations where it is expected that the user might be able to resolve the conflict and resubmit the request. The response body SHOULD include enough information for the user to recognize the source of the conflict. Ideally, the response entity would include enough information for the user or user agent to fix the problem; however, that might not be possible and is not required.
If you consider the "current state of the resource" to be "it doesn't exist yet, but you could create it".
It seems useful to distinguish between requests that could be fulfilled if the database contained different things, and requests that couldn't.