Suppose I PUT to /api/resource/50
and in the body I have {"Id": 12, ...}
Is there a 4xx HTTP status for this mismatch? Am I thinking about this the wrong way? Right now I'm just returning 400.
What about 409
Conflict?
The
409
(Conflict) status code indicates that the request could not be completed due to a conflict with the current state of the target resource. This code is used in situations where the user might be able to resolve the conflict and resubmit the request. The server SHOULD generate a payload that includes enough information for a user to recognize the source of the conflict. [...]
But using 400
shouldn't be a problem. Just make sure you return some details about the error in the response payload.