HTTP Return Codes

HTTP Return Codes

Introduction

HTTP return codes, also known as status codes, are three-digit numerical codes used to indicate an HTTP transaction’s status. The server sends them in response to a request from a client. Each code is assigned a meaning that provides information about the success or failure of the request, as well as any additional details that may be relevant.

HTTP return codes are classified into five main categories:

  1. Informational (1xx): These codes indicate that the request has been received and is being processed.
  2. Success (2xx): These codes indicate that the request was successful and the requested resource has been provided.
  3. Redirection (3xx): These codes indicate that the client should take additional action in order to complete the request.
  4. Client Error (4xx): These codes indicate that the client has made an error in its request.
  5. Server Error (5xx): These codes indicate that the server has encountered an error and was unable to fulfill the request.

Return Codes and Meanings

1xx Informational Responses

1xx status codes indicate that the request has been received and the client should continue processing.

  • 100 Continue: The server has received the request headers and the client should continue sending the request body.
  • 101 Switching Protocols: The server is switching protocols and the client should change its request accordingly.
  • 102 Processing: The request has been received and is being processed.
  • 103 Early Hints: The server is sending some preliminary information which may be useful to the client.

2xx Successful Responses

2xx status codes indicate that the request was successfully received, understood, and accepted.

  • 200 OK: The request was successful and the requested resource has been provided in the response body.
  • 201 Created: The request was successful and a new resource has been created with the specified URI.
  • 202 Accepted: The request was received but processing is still ongoing. The client will receive a notification when the request has been completed.
  • 203 Non-Authoritative Information: The response is a representation of the requested resource, but the origin server does not guarantee its accuracy.
  • 204 No Content: The request was successful but the response body does not contain any data.
  • 205 Reset Content: The client should reset the current resource representation to the newly specified state.
  • 206 Partial Content: Only part of the requested resource has been returned.
  • 207 Multi-Status: The response contains multiple status codes, each corresponding to a different part of the request.

3xx Redirection Messages

3xx status codes indicate that the client should take additional action to complete the request.

  • 300 Multiple Choices: The requested resource is available from multiple locations, and the client should choose one.
  • 301 Moved Permanently: The requested resource has been permanently moved to a new URI, and the client should update its records accordingly.
  • 302 Found: The requested resource is temporarily available from a different URI and the client should update its records accordingly.
  • 303 See Other: The client should use a different URI to obtain the requested resource.
  • 304 Not Modified: The client has already cached the requested resource and no further action is required.
  • 305 Use Proxy: The client should use the specified proxy server to access the requested resource.
  • 307 Temporary Redirect: The client should temporarily use the specified URI to access the requested resource.

4xx Client Errors

4xx status codes indicate that the client has made an error in its request.

  • 400 Bad Request: The request was invalid or malformed.
  • 401 Unauthorized: The client must authenticate itself to access the requested resource.
  • 402 Payment Required: Payment is required to access the requested resource.
  • 403 Forbidden: The client has no permission to access the requested resource.
  • 404 Not Found: The requested resource could not be found.
  • 405 Method Not Allowed: The request method is not supported for the requested resource.
  • 406 Not Acceptable: The client has requested a representation that the server cannot provide.
  • 407 Proxy Authentication Required: The client must authenticate with the proxy server before accessing the requested resource.
  • 408 Request Timeout: The client did not send a complete request within the specified time.
  • 409 Conflict: The request could not be completed due to a conflict with the current resource state.
  • 410 Gone: The requested resource has been permanently deleted and will not be available again.
  • 411 Length Required: The request is missing a Content-Length header, which is required for specific request methods.
  • 412 Precondition Failed: The request failed due to a precondition that was specified in the request headers.
  • 413 Request Entity Too Large: The request body is larger than the server is willing to accept.
  • 414 Request-URI Too Long: The length of the request URI exceeds the server’s maximum length.
  • 415 Unsupported Media Type: The request is using an unsupported media type for the requested resource.
  • 416 Requested range not satisfiable: The client requested a range of resources that are not available.
Stephen

Hi, my name is Stephen Finchett. I have been a software engineer for over 30 years and worked on complex, business critical, multi-user systems for all of my career. For the last 15 years, I have been concentrating on web based solutions using the Microsoft Stack including ASP.Net, C#, TypeScript, SQL Server and running everything at scale within Kubernetes.