What is HTTP?
The Hypertext Transfer Protocol (HTTP) its use for the making the communication between user and server its work request response over client and browser
Some method of https by which server communicate with client or vise versa
|
|||||||
HTTP Method | Possible Web API Action Method Name | Usage | |||||
GET | Get() | For Fetching the details from server or Url/Retrieves data. | |||||
get() | |||||||
GET() | |||||||
Ex GetDetails() | |||||||
Any Name Starting with GET | |||||||
POST | Post() | Post the Data on server its use to insertdata into data base | |||||
post() | |||||||
POST() | |||||||
PostNewData() | |||||||
//Post the Data on server | |||||||
PUT | Put() | Updates existing record. Over any Id or else | |||||
put() | |||||||
PUT() | |||||||
PUTDetails() | |||||||
|
|||||||
PATCH | Patch() | Update record partialy | |||||
patch() | |||||||
PATCH() | |||||||
PatchDetails() | |||||||
|
|||||||
DELETE |
|
Deletes record. | |||||
|
|||||||
DELETE() | |||||||
DeleteStudent() | |||||||
//any name starting with Delete |
When We Use GET() //Method
In Api we use Get() method for request/fetch the data/details from url/server and database
The get method is common use in http methods
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)
When We Use POST() //Method
In Api we use POST() method to insert the data into database
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
when we use PUT() //Method
Put is use for update the resource but Post is also use for update the resource so
Why we use Put over Post
because When we call put method multiple time always produce the same result.
When we call Post method multiple time its has side effects always produce the same result.
when we use PATCH() //Method
HTTP PATCH() requests make partial update on a resource/server. If you see PUT() request are also modify aresource entity
So lets make more clear
PATCH() method are the perfact choice for partially updating an
existing resource and PUT() should only used if you’re replacing a resource in its entirety.
0 Comments
Post a Comment