al-amiir / Questions

0 stars 0 forks source link

HTTP Verbs #2

Open mohamed-abdul-fattah opened 3 years ago

mohamed-abdul-fattah commented 3 years ago

You mentioned in #1

 xhr.open("GET", "user.json", true);

So,

  1. What are other common HTTP verbs?
  2. What are the differences between GET and POST?
  3. What is the purpose of each HTTP verb?
  4. Why cannot we use GET for all scenarios instead of using multiple HTTP verbs?
al-amiir commented 3 years ago

1) Other HTTP verbs :

2) Difference between GET & POST

3) Purpose of each verb

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 ?

mohamed-abdul-fattah commented 3 years ago

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

mohamed-abdul-fattah commented 3 years ago

Q2. Key differences between GET and POST

There for GET requests are only used to request data (not modify)

mohamed-abdul-fattah commented 3 years ago

Q3. 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.