HTTP - Request Method (Get, Post, Put, …)

About

The http method is a header of http request that defines the type of operation.

List

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

Method Description Cached by default Html element Request Body Used
GET (Default) Transfer a current representation of the target resource.
Commonly used to download web pages
Yes Html, Img, Link No
POST Perform resource-specific processing on the request payload.
Commonly used to transmit form submission data to a web server.
No Form Yes
PUT Replace all current representations of the target resource with the request payload. No
HEAD Same as GET, but only transfer the status line and header section. No
DELETE Remove all current representations of the target resource No
CONNECT Establish a tunnel to the server identified by the target resource. No
OPTIONS Describe the cross communication options for the target resource. No
TRACE Perform a message loop-back test along the path to the target resource. No

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

Syntax

The syntax is defined in the section 3.1.1. Request Line

In a http message

method         = token

where token defines the method

Management

Allowed

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.

Powered by ComboStrap