I usually think of PUT as a replace.
given an entity A when I PUT entity B into A then B will replace A and A will be gone forever
A practical example is saving a new file B to the location of an existing file A.
Likewise, I think of PATCH as a merge.
given an entity A when I PATCH entity B into A then A and B will merge to become C and C will replace A and A and B will be gone forever
A practical example is writing a new field value B to a SQL record A. The resulting SQL record C contains fields from both A and B.
Completely agree with you. That perfectly describes what PUT and PATCH should do.
PUT
PATCH
I avoided using that terminology as I have seen that developers new REST style find it difficult to understand that. And then there is this.
Maybe, this is a topic for its own blog?
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I usually think of PUT as a replace.
A practical example is saving a new file B to the location of an existing file A.
Likewise, I think of PATCH as a merge.
A practical example is writing a new field value B to a SQL record A. The resulting SQL record C contains fields from both A and B.
Completely agree with you. That perfectly describes what
PUT
andPATCH
should do.I avoided using that terminology as I have seen that developers new REST style find it difficult to understand that. And then there is this.
Maybe, this is a topic for its own blog?