Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. HTTP
  3. Reference
  4. HTTP response status codes
  5. 200 OK

200 OK

The HTTP200 OKsuccessful response status code indicates that a request has succeeded.A200 OK response is cacheable by default.

A200 OK response has a different meaning and format depending on the HTTP request method.Here's how they vary for different methods:

  • GET: A resource was retrieved by the server and included in the response body.
  • POST: An action succeeded; the response has a message body describing the result.
  • HEAD: Identical toGET, except there is no message body.
  • TRACE: The response has a message body containing the request as received by the server.

Although possible, successfulPUT orDELETE requests often do not result in a200 OK response.It is more common to see201 Created if the resource is uploaded or created for the first time, or204 No Content upon successful deletion of a resource.

Status

http
200 OK

Examples

Receiving a200 OK for aGET request

In this example, a successfulGET request tohttps://example.com returns a200 OK response.The response includes representation headers and a message body with the HTML content:

http
HTTP/1.1 200 OKAccept-Ranges: bytesAge: 294510Cache-Control: max-age=604800Content-Type: text/html; charset=UTF-8Date: Fri, 21 Jun 2024 14:18:33 GMTEtag: "3147526947"Expires: Fri, 28 Jun 2024 14:18:33 GMTLast-Modified: Thu, 17 Oct 2019 07:18:26 GMTServer: ECAcc (nyd/D10E)X-Cache: HITContent-Length: 1256<!doctype html><!-- HTML content follows here -->

Receiving a200 OK for aPOST request in form submission

Assuming a form exists to send data to an endpoint for managing subscriptions athttp://example.com/subscribe.APOST request to subscribe a user may look like the following:

http
POST /subscribe HTTP/1.1Host: example.comContent-Type: application/x-www-form-urlencodedContent-Length: 50name=Brian%20Smith&email=brian.smith%40example.com

In this example, a response with a200 OK status could look like this:

http
HTTP/1.1 200 OKContent-Type: application/json{  "message": "User subscription pending. A confirmation email has been sent.",  "subscription": {    "name": "Brian Smith",    "email": "brian.smith@example.com",    "id": 123,    "feed": "default"  }}

Specifications

Specification
HTTP Semantics
# status.200

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp