Unit content
HTTP
HTTP is an application protocol for exchanging requests and responses between clients and servers. It is the central protocol used to transfer web resources and to build many web APIs.
Requests
An HTTP request contains a method, a target resource and headers, and may contain a body.
Common methods include:
GETto retrieve a representation;POSTto submit data or request processing;PUTandPATCHto modify resources under appropriate application semantics;DELETEto request removal.
Responses
The server replies with a status code, headers and optionally a body.
Examples include:
200 OK
404 Not Found
500 Internal Server Error
The status code describes the result of the HTTP request, not whether every application-level goal was semantically successful.
Headers and bodies
Headers carry metadata such as content type, caching information or authentication data. The body can contain HTML, JSON, an image or any other media type understood by the participants.
Stateless protocol semantics
Each HTTP request is independently meaningful at the protocol level. Applications can still build sessions by sending identifiers such as cookies across several requests.
HTTP and HTTPS
HTTPS is HTTP carried through a security layer that provides encrypted and authenticated communication with the server under the relevant certificate and trust model.
HTTP defines the web request-response semantics; lower transport and security layers carry those messages between endpoints.