HTTPQUERY
English

200 OK

Usage

A 200 OK response always includes a message body, though the server is free to set the body length to zero. Depending on the server, this is expected when processing a PUT, DELETE, or OPTIONS request.

When the server has no content to return, the 204 status code is more appropriate. For requests creating a new resource, such as a POST creating content, a 201 status code is returned instead.

GET

A GET response contains the message body of the requested resource.

Request

GET /document.pdf HTTP/1.1
Host: example.com

Response

HTTP/1.1 200 OK
Content-Type: application/pdf
Content-Length: 10000

<message body contains the requested PDF document>

A HEAD response contains the same headers as a GET response, with no message body.

Request

HEAD / HTTP/1.1
Host: example.com

Response

HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8

POST

A POST response typically contains information about the result of the action or progress status.

Request

POST /api/data HTTP/1.1
Host: example.com
Content-Type: application/json
Content-Length: 24

{"name":"example entry"}

Response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 18

{"success":"true"}

PUT

A PUT response typically contains information about the result of the action or progress status.

Request

PUT /api/data/1 HTTP/1.1
Host: example.com
Content-Type: application/json
Content-Length: 24

{"name":"updated entry"}

Response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 18

{"success":"true"}

TRACE

A TRACE response contains the request message as the server received the request.

Request

TRACE / HTTP/1.1
Host: example.com

Response

HTTP/1.1 200 OK
Content-Type: message/http
Content-Length: 38

TRACE / HTTP/1.1
Host: example.com

DELETE

A DELETE response includes a status indication of the completed action.

Request

DELETE /api/data/1 HTTP/1.1
Host: example.com

Response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 18

{"deleted":"true"}

OPTIONS

An OPTIONS response includes the Allow header listing the HTTP methods the server accepts. Optionally, the server specifies further details in the message body.

Request

OPTIONS / HTTP/1.1
Host: example.com

Response

HTTP/1.1 200 OK
Allow: GET,HEAD,PUT,OPTIONS
Content-Type: text/plain;charset=UTF-8

Code references

.NET

HttpStatusCode.OK

Rust

http::StatusCode::OK

Rails

:ok

Go

http.StatusOK

Symfony

Response::HTTP_OK

Python3.5+

http.HTTPStatus.OK

Java

java.net.HttpURLConnection.HTTP_OK

Apache HttpComponents Core

org.apache.hc.core5.http.HttpStatus.SC_OK

Angular

@angular/common/http/HttpStatusCode.Ok