ch1ll
ch1ll

Reputation: 513

REST PATCH/PUT with version of model

Via GET I receive a representation of an entity which includes a version attribute.
Now I want to PATCH that entity, do I include this very version attribute and let the server decide to either accept or decline (if it was altered in the meantime) my PATCH request? Same logic would apply to PUT requests I believe.

Should the server give the client the chance to know that it might overwrite "old" data?
Or is it in the nature of REST that "newer equals newer"?

Are there any best practices or thoughts on this topic?

What I found so far is the ability for the client to control the behaviour, via the test operation of the PATCH method. See baeldung-json-patch-test-operation

Upvotes: 0

Views: 36

Answers (0)

Related Questions