Question:
What are the HTTP request methods, among which are GET
, POST
and DELETE
? What should each of them be used for, and what is the difference between them?
Answer:
- GET : Require a representation of the specified resource (The same resource can have multiple representations, for example services that return XML and JSON).
- HEAD : Returns the headers of a response (without the body containing the resource)
- POST : Sends an entity and requests that the server accept it as a subordinate of the resource identified by the URI.
- PUT : Require an entity to be stored under the given URI. If the URI refers to a resource that already exists, it is modified; if the URI does not point to an existing resource, then the server can create the resource with that URI.
- DELETE : Deletes the specified resource.
- TRACE : Echoes back the incoming request to the client to see if there were any changes and additions made by intermediate servers.
- OPTIONS : Returns the HTTP methods the server supports for the specified URL.
- CONNECT : Converts the connection request to a transparent TCP/IP tunnel, usually to facilitate SSL-encrypted (HTTPS) communication through an unencrypted HTTP proxy.
- PATCH : Used to apply partial modifications to a feature.
Source: Wikipedia – Hypertext Transfer Protocol