DEV Community

Discussion on: A fundamental guide for Designing Good REST API

Collapse
 
sebastian_wessel profile image
Sebastian Wessel

Nice article.
I prefer PATCH instead of PUT for updating entities.
PUT is defined as create or update a record and should send the whole record.
PATCH only updates an existing entity and should return an error if this entity does not exist. Also PATCH can partially update, while PUT is expected to send the whole data.
So for regular CRUD - POST, GET, PATCH, DELETE.
If you have something like a daily counter PUT is ideal. Create a day entry if not exist or update the existing one.

Collapse
 
junedang profile image
June Dang

Great explain about updating HTTP method Sebastian
Yes, I agree with you. In the article I just mention a few popular methods so that it is not too long for beginners to feel exhausted 😉