What should be the response if the id of the URI is different from the id of the body when the client try to update a resource ? EG :
The URI :
PUT /members/123
The body
{
id : 456,
name : "john"
}
https://www.rfc-editor.org/rfc/rfc7231#section-4.3.4
An origin server SHOULD verify that the PUT representation is consistent with any constraints the server has for the target resource that cannot or will not be changed by the PUT. This is particularly important when the origin server uses internal configuration information related to the URI in order to set the values for representation metadata on GET responses. When a PUT representation is inconsistent with the target resource, the origin server SHOULD either make them consistent, by transforming the representation or changing the resource configuration, or respond with an appropriate error message containing sufficient information to explain why the representation is unsuitable. The 409 (Conflict) or 415 (Unsupported Media Type) status codes are suggested, with the latter being specific to constraints on Content-Type values.
The requirement that an id in the body should match the identifier of the resource (or equivalently, the requirement that the resource identifier is immutable) would count as a constraint upon the resource. So if that's the case, you should leave the entire resource unmodified, and return a 409 with an error message.
That said, there's no particular reason that the identifier and the representation need to have any data in common. Think hashmap/dictionary/key-value store. There's nothing wrong with storing the state id:456
under the key /members/123
. If that's appropriate in your resource model, then put the new representation into the store and return 200.