httpmethodsrequestprotocols

How many HTTP verbs are there?


I count 9 HTTP request methods (aka verbs):

GET
HEAD
POST
PUT
DELETE
CONNECT
OPTIONS
TRACE
PATCH

The above from: https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods

Is that it? will this ever change?


Solution

  • Registry

    The HTTP 1.1 spec defines an Hypertext Transfer Protocol (HTTP) Method Registry. As of 2017-01, shows 39 entries:

    HTTP 1.0

    HTTP 1.0 defined three methods (“verbs”):

    HTTP 1.1

    HTTP 1.1 is officially defined in RFC 2068. This spec added five more methods.

    HTTP Extensions

    Other protocols extend HTTP to define additional methods/verbs.

    HTTP/2

    HTTP/2 is defined in RFC 7540. Section 3.5 defines a PRI method.

    Prognostication

    will this ever change?

    Not likely.

    Given the wide use of Web RPC and SOAP, and now the rising popularity of RESTful services bringing new life to the existing basic verbs, there is little need to devise new verbs at the HTTP level. Where people need their own domain-specific meaningful verbs, they can embed within the message being delivered via HTTP.

    I expect we’ll not see more HTTP methods become popular any time soon.

    Custom Method (verb)

    Be aware that you are allowed to invent you own custom methods.

    To quote the HTTP/1.1 specification, section 9 Method Definitions:

    The set of common methods for HTTP/1.1 is defined below. Although this set can be expanded, additional methods cannot be assumed to share the same semantics for separately extended clients and servers.

    So you can define your own methods. But, of course, you cannot expect that method to mean anything to just any server. You must ensure that both the client and the server are programmed to expect and comprehend your invented verb.

    When you invent a custom method, be sure it is included in the response from OPTIONS.

    Update circa 2022: QUERY

    One new verb has been proposed, but seems to have died: QUERY. See The HTTP QUERY Method at the IETF.

    To quote:

    … a means of making a safe, idempotent request that contains content.

    Most often, this is desirable when the data conveyed in a request is too voluminous to be encoded into the request's URI.