HTTP

Hypertext Transfer Protocol

  • HTTP is an application-layer protocol for transmitting hypermedia documents, such as HTML.

  • HTTP follows a classical client-server model, with a client opening a connection to make a request, then waiting until it receives a response from the server.

  • HTTP is a stateless protocol, meaning that the server does not keep any data (state) between two requests.

HTTP headers

let the client and the server pass additional information with an HTTP request or response

  • Request headers - contain more information about the resource to be fetched, or about the client requesting the resource.

  • Response headers - hold additional information about the response, like its location or about the server providing it.

  • Representation headers - contain information about the body of the resource, like its MIME type, or encoding/compression applied.

  • Payload headers - contain representation-independent information about payload data, including content length and the encoding used for transport.

HTTP request methods

indicate the desired action to be performed for a given resource

Although they can also be nouns, these request methods are sometimes referred to as HTTP verbs.

VerbsDescription

GET

The GET method requests a representation of the specified resource. Requests using GET should only retrieve data.

POST

The POST method submits an entity to the specified resource, often causing a change in state on the server.

PUT

The PUT method replaces all current representations of the target resource with the request payload.

DELETE

The DELETE method deletes the specified resource.

PATCH

The PATCH method applies partial modifications to a resource.

All methods are , as well as PUT and DELETE. The POST method is not idempotent.

HTTP response status codes

indicate whether a specific HTTP request has been successfully completed

ClassCodesDescription

1xx

Information reponses

2xx

Successful responses

200

OK

201

Created

204

No Content

205

Reset Content

3xx

Redirection messages

300

Multiple Choices

301

Moved Permanently

302

Found

4xx

Client-error responses

400

Bad Request

401

Unauthorized

403

Forbidden

404

Not Found

429

Too Many Requests

5xx

Server-error responses

500

Internal Server Error

502

Bad Gateway

503

Service Unavailable

504

Gateway Timeout

Last updated