Differences between GET, POST, PUT, PATCH, DELETE

The most commonly used HTTP verbs POST, GET, PUT, DELETE are similar to CRUD (Create, Read, Update, Delete) operations in database.

verb: POST

1) POST: POST method means Create new resources. On successful creation, return HTTP status code 201, returning a locaion header with a link to the newly-created resource.

verb: GET

2) GET: We can read-only by GET method. Ex. In browser address bar we type a link. It instruct the server to transmit the data indentified by the url to the client. client only read this data. In this sense, a GET request is read-only. HTTP response code 200 (OK). In an error case, it returns 404 (NOT FOUND) or 400 (BAD REQUEST).

verb: PUT

3. PUT: PUT method is used for update resource. on successful update, it returns 200 ( or 204 if not returning any content in the body ).

verb: DELETE

4.DELETE: DELETE method is used for delete a resource identified by a URI. on successful deletion, return HTTP status code 200 (OK).


5. PATCH: PATCH request says that we would only send the data that we need to modify without modifying other parts of the data. Ex. If we have data. There are firstName and lastName. If we need to update only the firstName, we pass only firstName.

Thank you for reading happy coding. No regret keep going.

I am a full-stack web developer. Programming makes our life better. Writing code is my hobby. I am very passionate to write code.