Tuesday, August 24, 2021

PUT, GET, POST Methods

Some other notes on PUT requests:

GET : Request to Read/Fetch the data from Database
Post : Request to Create data in Database.
PUT : Request to Modify the data in Database.
PATCH : Request to Modify the Partially Data
---------
PUT method is called when you have to modify a single resource
PUT method response can be cached
You can use UPDATE query in PUT
In PUT method, the client decides which URI resource should have
PUT works as specific
If you send the same PUT request multiple times, the result will remain the same
PUT method is idempotent

Some other notes on GET requests:

GET requests can be cached
GET requests remain in the browser history
GET requests can be bookmarked
GET requests should never be used when dealing with sensitive data
GET requests have length restrictions
GET requests are only used to request data (not modify)


Some other notes on POST requests:

POST requests are never cached
POST requests do not remain in the browser history
POST requests cannot be bookmarked
POST requests have no restrictions on data length

PUT and POST Methods Differences :

PUT method is called when you have to modify a single resource while POST method is called when you have to add a child resource.
PUT method response can be cached but you cannot cache POST method responses.
You can use UPDATE query in PUT whereas you can use create query in POST.
In PUT method, the client decides which URI resource should have, and in POST method, the server decides which URI resource should have.
PUT works as specific while POST work as abstract.
If you send the same PUT request multiple times, the result will remain the same but if you send the same POST request multiple times, you will receive different results.
PUT method is idempotent whereas POST method is not idempotent.

No comments:

Post a Comment

Thread

Native Thread Demon Thread Non-Demon Thread Native Thread: - Any Method/Thread which is mapped to OS is called Native Thread or Method. Demo...