Open mohamed-abdul-fattah opened 3 years ago
1) Other HTTP verbs :
2) Difference between GET & POST
3) Purpose of each verb
HEAD , gets the headers in the response of a request , without the body of response
PUT , update the data retrieved from server through GET method , if any new POST request cause the data to be changed
DELETE , deletes data
CONNECT , establishes a tunnel to the server
OPTIONS , describe the communication options for the server
4) Because every verb has it own properties , however GET could post data through query parameters , but data should be simple and not sensitive like password and username , right ?
Q1. PATCH
HTTP verb is missing. What is the purpose of PATCH
and what is the difference between PATCH
and PUT
?. CONNECT
is not common and you can discard this one.
Resource ignore the implementation section
Q2. Key differences between GET
and POST
GET
requests can be cachedGET
requests remain in the browser historyGET
requests can be bookmarkedGET
requests have length restrictions (about 2k characters in the URL bar differs from browser to browser)GET
requests, and they might take actions if actions are implemented with GET
HTTP method like creating some records unintentionally.GET
requests can be copied via the URL and shared. That's why search filters are preferred to be GET
requests to share your filter results easily with others. E.g. Here is a search result from Google https://www.google.com/search?channel=fs&client=ubuntu&q=search+result will take you to the same page I opened.There for GET
requests are only used to request data (not modify)
POST
requests are never cachedPOST
requests do not remain in the browser historyPOST
requests cannot be bookmarkedPOST
requests have no restrictions on data lengthQ3. The reasons we cannot use GET
over other HTTP verbs are as mentioned in Q2 (because it should not take actions). The reasons why we should not use like POST
over DELETE
is because these methods are following the semantics of a software architecture style called REST which we can ignore for now.
You mentioned in #1
So,
GET
andPOST
?GET
for all scenarios instead of using multiple HTTP verbs?