HTTP: HYPERTEXT TRANSFER PROTOCOL

created: 30.10.2018 10:08

edited: 02.11.2018 15:14

back

HTTP functions as a request–response protocol in the client–server computing model. A web browser, for example, may be the client and an application running on a computer hosting a website may be the server. The client submits an HTTP request message to the server. The server, which provides resources such as HTML files and other content, or performs other functions on behalf of the client, returns a response message to the client. The response contains completion status information about the request and may also contain requested content in its message body.

text
Request Methods:
GET: Requests using GET should only retrieve data and should have no other effect.
HEAD: The HEAD method asks for a response identical to that of a GET request, but without the response body.
POST: The data POSTed might be, for example, an annotation for existing resources; a message for a bulletin board, newsgroup, mailing list, or comment thread; a block of data that is the result of submitting a web form to a data-handling process; or an item to add to a database.
PUT: If the URI refers to an already existing resource, it is modified; if the URI does not point to an existing resource, then the server can create the resource with that URI.
DELETE: The DELETE method deletes the specified resource.
TRACE: The TRACE method echoes the received request so that a client can see what (if any) changes or additions have been made by intermediate servers.
OPTIONS: The OPTIONS method returns the HTTP methods that the server supports for the specified URL. This can be used to check the functionality of a web server by requesting '*' instead of a specific resource.
CONNECT: The CONNECT method converts the request connection to a transparent TCP/IP tunnel, usually to facilitate SSL-encrypted communication (HTTPS) through an unencrypted HTTP proxy.
PATCH: The PATCH method applies partial modifications to a resource.

What are idempotent methods?
An idempotent HTTP method is a HTTP method that can be called many times without different outcomes. It would not matter if the method is called only once, or ten times over. The result should be the same. Again, this only applies to the result, not the resource itself. This still can be manipulated (like an update-timestamp, provided this information is not shared in the (current) resource representation.

a = 4 // idempotent
a++ // not idempotent

text
HTTP Method	Idempotent
OPTIONS	        yes
GET             yes
HEAD	        yes
PUT             yes
POST	        no
DELETE	        yes
PATCH	        no