http statusCode(状态码)

转自:1) http://specs.openstack.org/openstack/keystone-specs/api/v3/identity-api-v3.html#unauthorized

     2) http://openq.cn/http-statuscode-status-code-200300400500-sequence/

完整版在这里: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

HTTP Status Codes

The Identity API uses a subset of the available HTTP status codes to communicate specific success and failure conditions to the client.

200 OK

This status code is returned in response to successful GETHEAD and PATCH operations.

201 Created

This status code is returned in response to successful POST operations.

204 No Content

This status code is returned in response to successful HEADPUT and DELETE operations.

300 Multiple Choices

This status code is returned by the root identity endpoint, with references to one or more Identity API versions (such as /v3/).

400 Bad Request

This status code is returned when the Identity service fails to parse the request as expected. This is most frequently returned when a required attribute is missing, a disallowed attribute is specified (such as an idon POST in a basic CRUD operation), or an attribute is provided of an unexpected data type.

The client is assumed to be in error.

401 Unauthorized

This status code is returned when either authentication has not been performed, the provided X-Auth-Token is invalid or authentication credentials are invalid (including the user, project or domain having been disabled).

403 Forbidden

This status code is returned when the request is successfully authenticated but not authorized to perform the requested action.

404 Not Found

This status code is returned in response to failed GETHEADPOSTPUTPATCH and DELETE operations when a referenced entity cannot be found by ID. In the case of a POST request, the referenced entity may be in the request body as opposed to the resource path.

409 Conflict

This status code is returned in response to failed POST and PATCH operations. For example, when a client attempts to update an entity’s unique attribute which conflicts with that of another entity in the same collection.

Alternatively, a client should expect this status code when attempting to perform the same create operation twice in a row on a collection with a user-defined and unique attribute. For example, a User’sname attribute is defined to be unique and user-defined, so making the same POST /users request twice in a row will result in this status code.

The client is assumed to be in error.

500 Internal Server Error

This status code is returned when an unexpected error has occurred in the Identity service implementation.

501 Not Implemented

This status code is returned when the Identity service implementation is unable to fulfill the request because it is incapable of implementing the entire API as specified.

For example, an Identity service may be incapable of returning an exhaustive collection of Projects with any reasonable expectation of performance, or lack the necessary permission to create or modify the collection of users (which may be managed by a remote system); the implementation may therefore choose to return this status code to communicate this condition to the client.

503 Service Unavailable

This status code is returned when the Identity service is unable to communicate with a backend service, or by a proxy in front of the Identity service unable to communicate with the Identity service itself.

===============================下边是中文的,与上边内容基本一致====================================================================

201-206都表示服务器成功处理了请求的状态代码,说明网页可以正常访问。
200(成功) 服务器已成功处理了请求。通常,这表示服务器提供了请求的网页。
201(已创建) 请求成功且服务器已创建了新的资源。
202(已接受) 服务器已接受了请求,但尚未对其进行处理。
203(非授权信息) 服务器已成功处理了请求,但返回了可能来自另一来源的信息。
204(无内容) 服务器成功处理了请求,但未返回任何内容。
205(重置内容) 服务器成功处理了请求,但未返回任何内容。与 204 响应不同,此响应要求请求者重置文档视图(例如清除表单内容以输入新内容)。
206(部分内容) 服务器成功处理了部分 GET 请求。

300-3007表示的意思是:要完成请求,您需要进一步进行操作。通常,这些状态代码是永远重定向的。

300(多种选择) 服务器根据请求可执行多种操作。服务器可根据请求者 来选择一项操作,或提供操作列表供其选择。

301(永久移动) 请求的网页已被永久移动到新位置。服务器返回此响应时,会自动将请求者转到新位置。您应使用此代码通知搜索引擎蜘蛛网页或网站已被永久移动到新位置。
302(临时移动) 服务器目前正从不同位置的网页响应请求,但请求者应继续使用原有位置来进行以后的请求。会自动将请求者转到不同的位置。但由于搜索引擎会继续抓取原有位置并将其编入索引,因此您不应使用此代码来告诉搜索引擎页面或网站已被移动。
303(查看其他位置) 当请求者应对不同的位置进行单独的 GET 请求以检索响应时,服务器会返回此代码。对于除 HEAD 请求之外的所有请求,服务器会自动转到其他位置。
304(未修改) 自从上次请求后,请求的网页未被修改过。服务器返回此响应时,不会返回网页内容。

如果网页自请求者上次请求后再也没有更改过,您应当将服务器配置为返回此响应。由于服务器可以告诉 搜索引擎自从上次抓取后网页没有更改过,因此可节省带宽和开销。

305(使用代理) 请求者只能使用代理访问请求的网页。如果服务器返回此响应,那么,服务器还会指明请求者应当使用的代理。
307(临时重定向) 服务器目前正从不同位置的网页响应请求,但请求者应继续使用原有位置来进行以后的请求。会自动将请求者转到不同的位置。但由于搜索引擎会继续抓取原有位置并将其编入索引,因此您不应使用此代码来告诉搜索引擎某个页面或网站已被移动。

4XXHTTP状态码表示请求可能出错,会妨碍服务器的处理。

400(错误请求) 服务器不理解请求的语法。

401(身份验证错误) 此页要求授权。您可能不希望将此网页纳入索引。

403(禁止) 服务器拒绝请求。

404(未找到) 服务器找不到请求的网页。例如,对于服务器上不存在的网页经常会返回此代码。

例如:http://www.0631abc.com/20100aaaa,就会进入404错误页面

405(方法禁用) 禁用请求中指定的方法。

406(不接受) 无法使用请求的内容特性响应请求的网页。

407(需要代理授权) 此状态码与 401 类似,但指定请求者必须授权使用代理。如果服务器返回此响应,还表示请求者应当使用代理。

408(请求超时) 服务器等候请求时发生超时。

409(冲突) 服务器在完成请求时发生冲突。服务器必须在响应中包含有关冲突的信息。服务器在响应与前一个请求相冲突的 PUT 请求时可能会返回此代码,以及两个请求的差异列表。

410(已删除) 请求的资源永久删除后,服务器返回此响应。该代码与 404(未找到)代码相似,但在资源以前存在而现在不存在的情况下,有时会用来替代 404 代码。如果资源已永久删除,您应当使用 301 指定资源的新位置。

411(需要有效长度) 服务器不接受不含有效内容长度标头字段的请求。

412(未满足前提条件) 服务器未满足请求者在请求中设置的其中一个前提条件。

413(请求实体过大) 服务器无法处理请求,因为请求实体过大,超出服务器的处理能力。

414(请求的 URI 过长) 请求的 URI(通常为网址)过长,服务器无法处理。

415(不支持的媒体类型) 请求的格式不受请求页面的支持。

416(请求范围不符合要求) 如果页面无法提供请求的范围,则服务器会返回此状态码。

417(未满足期望值) 服务器未满足"期望"请求标头字段的要求。

500至505表示的意思是:服务器在尝试处理请求时发生内部错误。这些错误可能是服务器本身的错误,而不是请求出错。

500(服务器内部错误) 服务器遇到错误,无法完成请求。

501(尚未实施) 服务器不具备完成请求的功能。例如,当服务器无法识别请求方法时,服务器可能会返回此代码。

502(错误网关) 服务器作为网关或代理,从上游服务器收到了无效的响应。

503(服务不可用) 目前无法使用服务器(由于超载或进行停机维护)。通常,这只是一种暂时的状态。

504(网关超时) 服务器作为网关或代理,未及时从上游服务器接收请求。

505(HTTP 版本不受支持) 服务器不支持请求中所使用的 HTTP 协议版本。

原文地址:https://www.cnblogs.com/pinganzi/p/4518915.html