HTTP - Method (Get, Post, Put, ...)

> (World Wide) Web - (W3|WWW) > (HTTP|HTTPS) - Hypertext Transfer Protocol

1 - About

is an operation requested from the server.

HTTP defines a set of operations. By order of most frequent:

Method Description
GET Transfer a current representation of the target resource.
POST Perform resource-specific processing on the request payload
PUT Replace all current representations of the target resource with the request payload.
HEAD Same as GET, but only transfer the status line and header section.
DELETE Remove all current representations of the target resource
CONNECT Establish a tunnel to the server identified by the target resource.
OPTIONS (cors) Describe the communication options for the target resource.
TRACE Perform a message loop-back test along the path to the target resource.

Other protocols based on HTTP can define additional methods.

All general-purpose servers MUST support the methods GET and HEAD. All other methods are OPTIONAL.

A request method is considered idempotent


3 - Management

3.1 - List

The set of methods allowed by a target resource can be listed in an Allow header field (Section 7.4.1).

However, the set of allowed methods can change dynamically.

When a request method is received that is:

  • unrecognized or not implemented by an origin server, the origin server SHOULD respond with the 501 (Not Implemented) status code.
  • known by an origin server but not allowed for the target resource, the origin server SHOULD respond with the 405 (Method Not Allowed) status code.