2 ms·
Consistent and Beautiful RESTful API Design Tips from Experience
- half0wl 9y agoGreat article. I'd like to add that while `PUT` can be used for updating data, you should only ever use this if you are updating the entire object. It's more "replacing" the object with new values than updating it - i.e. what you `PUT` to the endpoint is the new object. Therefore, if you don't provide the entire object in the request, you can lose data. In most cases, even when updating entire objects, I prefer `PATCH` because of this - by design, it only overwrites what you specify.