Skip to content

HTTP

HTTP request methods

  • GET: Retrieve a resource.
  • HEAD: Retrieve the headers of a resource.
  • POST: Submit an entity to be processed by the resource identified by the URI.
  • PUT: Store an entity at a URI.
  • DELETE: Delete a resource identified by a URI.
  • CONNECT: Establish a network connection to a resource.
  • OPTIONS: Describe the communication options for a resource.
  • TRACE: Retrieve a diagnostic trace of the actions taken by a resource.
  • PATCH: Apply a partial update to a resource.

HTTP response status codes

  • 1xx Informational: Request received, continuing process.
  • 2xx Success: The request was successfully received, understood, and accepted.
  • 3xx Redirection: Further action must be taken to complete the request.
  • 4xx Client Error: The request contains bad syntax or cannot be fulfilled.
  • 5xx Server Error: The server failed to fulfill an apparently valid request.

HTTP headers

  • Accept: Specifies the media types that are acceptable for the response.
  • Authorization: Contains the credentials to authenticate a user-agent with a server.
  • Cache-Control: Specifies directives that control caching behavior along the request/response chain.
  • Content-Length: Specifies the length of the entity-body.
  • Content-Type: Specifies the media type of the entity-body.
  • Cookie: Contains state information for the current session.
  • Date: Indicates the date and time at which the message was originated.
  • ETag: Provides a unique identifier for the current version of the resource.
  • Expires: Gives the date and time after which the response is considered stale.
  • Host: Specifies the Internet host and port number for the resource.
  • If-Match: Makes the request conditional on the presence of a particular entity tag.
  • If-Modified-Since: Makes the request conditional on the modification date of the resource.
  • If-None-Match: Makes the request conditional on the absence of a particular entity tag.
  • If-Unmodified-Since: Makes the request conditional on the non-modification date of the resource.
  • Last-Modified: Indicates the date and time at which the resource was last modified.
  • Location: Provides a URI to a resource that is a substitute for the requested resource.
  • Pragma: Provides implementation-specific directives that might apply to any agent along the request/response chain.
  • Referer: Specifies the URI of the resource from which the request was obtained.
  • Server: Contains information about the server that generated the response.
  • Set-Cookie: Sends a cookie from the server to the user agent.
  • User-Agent: Contains information about the user agent originating the request.

HTTP authentication schemes

  • Basic authentication: Sends credentials as a Base64-encoded string in the Authorization header.
  • Digest authentication: Sends credentials as an MD5 hash in the Authorization header.
  • OAuth2 authentication: Sends credentials as an access token in the Authorization header.
  • Token authentication: Sends credentials as a token in the Authorization header.
  • Note: This cheat sheet covers the most commonly used HTTP elements. For a more detailed reference, refer to the HTTP/1.1 specification document.