[RESTful] HTTP status Code

Source: Internet
Author: User
Tags html form response code

The HTTP status code is a 3-bit number that is attached to the HTTP response, which is part of the protocol semantics and allows the client to know what is going on at the most basic level when the server is trying to process the request. The HTTP specification defines 411 response codes in total, and all status codes are described in this article.

First, the status code family

The first digit of the HTTP status code is a very general indication that the request is progressing. The HTTP specification uses the 5 status code family as the first number.

  1xx:information

Used only when negotiating between an HTTP client and a server.

  2xx:successful

Any state code conversions required by the client have occurred.

  3xx:redirection

The state transition requested by the client did not occur. However, if the client is willing to initiate a slightly different HTTP request, the request should complete the behavior requested by the client.

4xx:client Error

The state transition requested by the client did not occur due to an issue with the HTTP request. The request may be defective, illogical, contradictory, or the request cannot be accepted by the server.

5xx:server Error

  The state transitions requested by the client did not occur due to a server-side problem. The client may not be able to do anything but wait for the problem to be fixed.

Ii. minimum four status codes (200 301 400 500)

(OK)

Everything is going very well, the document of entity message weight (if any) is a statement of a resource.

301 (Moved permanently)

The status code is sent when the client triggers a state transition that moves a resource from one URL to another. After the move, the request sent to the old URL will also result in a 301 status code.

(Bad Request)

  There is a problem with the client. The document (if any) in the entity message body is an error message. You want the client to understand the error message and use it to fix the problem.

$ (Internal Server Error)

There is a problem on the server side. The document in the entity message body is an error message. The error message may not be helpful because the client cannot fix the server-side problem.

Third, status code list

  1xx:information

(Continue)

Importance: Low to Medium

This is one of the possible corresponding responses to HTTP look-before-you-leap (Lbyl) requests. The status code indicates that the client should resend its initial request, including (possibly larger or more sensitive) representations that were omitted in the first request. The client does not need to worry about sending a statement and then being rejected. Another possible response to the Lbyl request is 417 (expectation Failed).

101 (switching Protocols)

Importance: Very Low

The client only receives the response code when it uses the upgrade header in the request to notify the server that it wants to choose to use a protocol other than exclude HTTP. 101 Status code means "No problem, now I'm starting to talk to you with another protocol."

2xx:successful

  (OK)

Importance: Very High

This is the status code that the client would like to see in most cases. It indicates that the state transition has ended and can be used when a more specific and appropriate status code is not found in the 2XX series.

201 (Created)

Importance: High

When the server creates a new resource based on the client's request, it sends a change status code.

202 (Accepted)

Importance: Medium

The client's request cannot or will not be processed in real time, and will be processed later.

203 (non-authoritative information)

Importance: Very Low

The status code is the same as 200, but in addition the server wants the client to know some of the corresponding headers that are not from that server. These headers may be reflected from a previous request from the client, or obtained from a third-party organization.

204 (No Content)

Importance: High

This status code is usually sent in response to a non-secure request such as a put request, which means that the server has performed a state transition, but it refuses to send a description of any representation or state transitions back. The server may send back 204 in response to the corresponding GET request. This means that the requested resource exists, but it has an empty representation. Compared to 304 (not Modified), 204 is commonly seen in JavaScript applications in browsers. It allows the server to tell the client that the input to the client has been accepted, but that the client should not modify any UI elements.

205 (Requet Content)

Importance: Low

This state is similar to 204, but it implies that the client should reset the view or data structure of the source. If you submit an HTML form in your Web browser and get a 204 response, your data is still in the form, and you can modify it. But if you get a 205, these form fields will be reset to their original values.

206 (Partial conent)

Importance: Very high for the API that supports partial GET, while for other APIs it is relatively low.

The response code is similar to 200, but it is specified as a response to the partial GET request: That is, the request uses the Content-range request header. A client typically initiates a partial request to resume a download of a large, broken binary representation.

(not to be continued)

Reprint please indicate source: http://www.cnblogs.com/caoming/p/4158662.html

Reference: O ' REILLY RESTful Web APIS

[RESTful] HTTP status Code

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.