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?GET,?HEAD?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?HEAD,?PUT?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?GET,?HEAD,?POST,?PUT,?PATCH?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 協議版本。
總結
以上是生活随笔為你收集整理的http statusCode(状态码)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 站立会议第二篇
- 下一篇: 八、数据库服务连接存储(MPIO) 中