What are the HTTP request methods, and what is the difference between them?

36

What are the HTTP request methods, among which are GET , POST and DELETE ? Why should each of them be used, and what is the difference between them?

    
asked by anonymous 15.03.2014 / 16:32

3 answers

41
  • GET : Requires 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 accepts it as a child of the resource identified by the URI.
  • PUT : Requires an entity to be stored under the provided 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 : Echo back the incoming request for the client to see if there have been changes and additions made by intermediate servers.
  • OPTIONS : Returns the HTTP methods that the server supports for the specified URL.
  • CONNECT : Converts the connection request to a transparent TCP / IP tunnel, usually to facilitate encrypted communication with SSL (HTTPS) through an unencrypted HTTP proxy.
  • PATCH : Used to apply partial modifications to a resource.

Source: Wikipedia - Hypertext Transfer Protocol

    
15.03.2014 / 16:53
5

Basically, if this is what I understood, there are 8 types of methods of which:

GET, POST, DELETE, PUT, CONNECT, HEAD, TRACE, OPTIONS.

GET : Method that requests some resource or object to the server

HEAD : Request information from a particular object without it being sent to the client just to test the validity of the last access.

POST : Method used to send file / data or HTML form to server.

OPTIONS : Through this method the client gets the properties of the server.

DELETE : Informs the URL of the object to be deleted.

TRACE : To send loopback type message to test.

PUT : Accepts to create or modify some object of the server.

CONNECT : Communicate with Proxy Servers.

Sources: link

link

    
15.03.2014 / 16:49
1

GET , POST , PUT , DELETE are heavily used in web projects API and represent CRUD operations commonly used in databases.

    
15.03.2014 / 21:09