📡 HTTPステヌタスコヌド蟞兞

コヌド名前説明
100ContinueThe initial part of the request has been received and the client should continue with the request.
101Switching ProtocolsThe server is switching protocols as requested by the client via the Upgrade header.
102ProcessingThe server has received and is processing the request, but no response is available yet (WebDAV).
103Early HintsUsed to return some response headers before the final HTTP message, e.g. for preloading resources.
200OKThe request has succeeded.
201CreatedThe request has succeeded and a new resource has been created as a result.
202AcceptedThe request has been received but not yet acted upon.
203Non-Authoritative InformationThe returned metadata is not exactly the same as from the origin server, but from a local or third-party copy.
204No ContentThere is no content to send for this request, but the headers are useful.
205Reset ContentTells the client to reset the document that sent this request.
206Partial ContentUsed when the Range header is sent to only retrieve part of a resource.
207Multi-StatusConveys information about multiple resources for situations where multiple status codes are appropriate (WebDAV).
208Already ReportedUsed inside a DAV: propstat response element to avoid repeatedly enumerating internal members (WebDAV).
226IM UsedThe server has fulfilled a GET request and the response is a representation of the result of instance manipulations.
300Multiple ChoicesThe request has more than one possible response and the client should choose one.
301Moved PermanentlyThe URL of the requested resource has been changed permanently.
302FoundThe URI of requested resource has been changed temporarily.
303See OtherThe server sends this response to direct the client to get the requested resource at another URI with a GET request.
304Not ModifiedTells the client that the response has not been modified, so the client can continue to use the cached version.
305Use ProxyDefined in a previous version of the HTTP specification to indicate that a requested response must be accessed by a proxy. Deprecated.
307Temporary RedirectThe server sends this response to direct the client to get the requested resource at another URI with the same method used.
308Permanent RedirectThis means that the resource is now permanently located at another URI, specified by the Location response header.
400Bad RequestThe server cannot or will not process the request due to something that is perceived to be a client error.
401UnauthorizedThe client must authenticate itself to get the requested response.
402Payment RequiredReserved for future use, e.g. digital payment systems.
403ForbiddenThe client does not have access rights to the content, so the server is refusing to give the requested resource.
404Not FoundThe server cannot find the requested resource.
405Method Not AllowedThe request method is known by the server but is not supported by the target resource.
406Not AcceptableThe server cannot produce a response matching the list of acceptable values defined in the negotiation headers.
407Proxy Authentication RequiredSimilar to 401 but authentication is needed to be done by a proxy.
408Request TimeoutThe server would like to shut down this unused connection.
409ConflictThe request conflicts with the current state of the target resource.
410GoneThe requested content has been permanently deleted from the server, with no forwarding address.
411Length RequiredThe server refuses to accept the request without a defined Content-Length header.
412Precondition FailedThe client has indicated preconditions in its headers which the server does not meet.
413Payload Too LargeThe request entity is larger than limits defined by the server.
414URI Too LongThe URI requested by the client is longer than the server is willing to interpret.
415Unsupported Media TypeThe media format of the requested data is not supported by the server.
416Range Not SatisfiableThe range specified by the Range header cannot be fulfilled.
417Expectation FailedThe expectation indicated by the Expect header field cannot be met by the server.
418I'm a teapotThe server refuses the attempt to brew coffee with a teapot (an April Fools' joke, RFC 2324).
421Misdirected RequestThe request was directed at a server that is not able to produce a response.
422Unprocessable ContentThe request was well-formed but was unable to be followed due to semantic errors.
423LockedThe resource that is being accessed is locked (WebDAV).
424Failed DependencyThe request failed due to failure of a previous request (WebDAV).
425Too EarlyIndicates that the server is unwilling to risk processing a request that might be replayed.
426Upgrade RequiredThe server refuses to perform the request using the current protocol but might be willing to do so after the client upgrades.
428Precondition RequiredThe origin server requires the request to be conditional, to prevent lost update problems.
429Too Many RequestsThe user has sent too many requests in a given amount of time (rate limiting).
431Request Header Fields Too LargeThe server is unwilling to process the request because its header fields are too large.
451Unavailable For Legal ReasonsThe user requests a resource that cannot legally be provided, such as a web page censored by a government.
500Internal Server ErrorThe server has encountered a situation it does not know how to handle.
501Not ImplementedThe request method is not supported by the server and cannot be handled.
502Bad GatewayThe server, while acting as a gateway or proxy, received an invalid response from the upstream server.
503Service UnavailableThe server is not ready to handle the request, often due to maintenance or overload.
504Gateway TimeoutThe server is acting as a gateway and cannot get a response in time from the upstream server.
505HTTP Version Not SupportedThe HTTP version used in the request is not supported by the server.
506Variant Also NegotiatesThe server has an internal configuration error: the chosen variant resource is configured to engage in content negotiation itself.
507Insufficient StorageThe method could not be performed on the resource because the server is unable to store the representation needed (WebDAV).
508Loop DetectedThe server detected an infinite loop while processing the request (WebDAV).
510Not ExtendedFurther extensions to the request are required for the server to fulfil it.
511Network Authentication RequiredThe client needs to authenticate to gain network access.

62 ä»¶

1xxの情報レスポンスから5xxのサヌバヌ゚ラヌたで、暙準的なHTTPステヌタスコヌドずその意味を怜玢できる蟞兞です。カテゎリで絞り蟌んだり、コヌド番号・名前・キヌワヌドで怜玢したりできたす。API開発やデバッグ、フロント゚ンドの゚ラヌハンドリング実装に圹立ちたす。

䜿い方

  1. 怜玢欄にコヌド番号(䟋: 404)、名前(䟋: Not Found)、キヌワヌドを入力したす。
  2. 必芁に応じおカテゎリ(1xx〜5xx)で絞り蟌みたす。
  3. 䞀芧から該圓するステヌタスコヌドの意味を確認したす。

蚈算の仕組み

HTTPステヌタスコヌドは、サヌバヌがリク゚ストの凊理結果を3桁の数字で返すものです。意味は RFC 9110 などで定められおおり、最初の桁でおおたかな皮類がわかりたす。1xxは凊理の途䞭経過、2xxは成功、3xxはリダむレクト別の堎所を芋おほしい、4xxはクラむアント偎の問題、5xxはサヌバヌ偎の問題です。 䌌たコヌドの䜿い分けには意味がありたす。301ず308は恒久的な移転、302ず307は䞀時的な移転ですが、307・308はリク゚ストのメ゜ッドPOSTなどを倉えずにリダむレクトするこずが保蚌されおいる点が違いたす。401 Unauthorized は「認蚌されおいないログむンが必芁」、403 Forbidden は「認蚌されおいおも暩限がない」こずを衚したす。 APIでは、゚ラヌの皮類に合った正しいコヌドを返すこずで、クラむアント偎が状況を刀断しやすくなりたす。

蚈算䟋

「404」で怜玢した堎合 404 Not Foundリク゚ストされたリ゜ヌスが芋぀からない ログむンが必芁なAPIを、トヌクンなしで呌び出した堎合は 401、トヌクンはあるが管理者暩限が必芁な操䜜をした堎合は 403 を返すのが䞀般的です。 フォヌムの送信埌に結果ペヌゞぞ移動させる堎合は、ブラりザがGETで再取埗するよう 303 See Other を䜿うず、再読み蟌みで二重送信になるのを防げたす。

䜿甚䞊の泚意

  • 418 I'm a teapot はゞョヌクずしお定矩されたコヌドで、実際のAPIで䜿うものではありたせん。
  • 䞀郚のサヌバヌやサヌビスは、芏栌にない独自のコヌドを返すこずがありたす。
  • ステヌタスコヌドだけでなく、レスポンス本文の゚ラヌ内容もあわせお確認しおください。
  • ブラりザの開発者ツヌルのネットワヌクタブで、実際のステヌタスコヌドを確認できたす。

よくある質問

どのステヌタスコヌドが登録されおいたすか?

100 Continueから511 Network Authentication Requiredたで、IANAに登録されおいる暙準的なコヌドを網矅しおいたす。418 I'm a teapotのような珍しいコヌドも含たれたす。

名前でも怜玢できたすか?

はい。コヌド番号(䟋: 404)、名前(䟋: Not Found)、説明文䞭のキヌワヌドで怜玢できたす。

APIの゚ラヌハンドリング実装の参考にできたすか?

はい。4xx(クラむアント゚ラヌ)・5xx(サヌバヌ゚ラヌ)のカテゎリで絞り蟌み、どのコヌドをどんな堎面で返すべきかの参考にできたす。

301ず302の違いのような、䌌たコヌドの䜿い分けも確認できたすか?

はい。各コヌドの説明文に甚途が蚘茉されおいるため、リダむレクト系コヌド(301・302・307など)の違いを比范怜蚎する際に圹立ちたす。

デバッグ䞭に芋慣れないステヌタスコヌドが出た堎合は?

コヌド番号で怜玢すればすぐに意味を確認できるため、ブラりザの開発者ツヌルやAPIレスポンスで芋慣れないコヌドに遭遇した際にすぐ調べられたす。