Vous êtes sur la page 1sur 5

HTTP STATUS MESSAGES

HTTP STATUS CODE 2XX - SUCCESS

HTTP Status Message: 200 OK

Category: Successful

Explanation:
- What causes the HTTP Status Message?
This is the standard response for successful requests — it’s the status code you usually want
and expect.

When the request is GET (asking for a resource), the response will include the resource.
When the request is a POST (or other type), the response will contain a resource which
describes or contains the result of the action.

- Situations where you can receive the message​.

200 OK is the most common HTTP status code. It generally means that the HTTP request
succeeded.

If the HTTP request was a GET request, the response should include the full representation
of the resource.

If the response has no body, then the 204 No Content response body should be used instead.

HTTP Status Message: 201 Created

Category: Successful

Explanation:
- What causes the HTTP Status Message?
Some requests are intended to create a new resource. When these complete
successfully, the 201 status is sent to indicate that the new resource has been created.
This is usually used in conjunction with the PUT request type.
- Situations where you can receive the message.

201 Created, just like 200 OK, means that the request was successful, but it also resulted in a
new resource being created.

In the case of a PUT request, it means that a new resource was created on the actual url that
was specified in the request.

POST requests
If you got a 201 in response to a POST request, it means that a new resource was created at
a different endpoint. For those cases, a Location header must be included to indicate where
the new resource lives.

HTTP Status Message: 202 Accepted

Category: Successful

Explanation:
- What causes the HTTP Status Message?
The request has been accepted, but not acted upon. The request may or may not be
acted upon.

- Situations where you can receive the message​.

202 Accepted, means that the server accepted the request, but it’s not sure yet if the request
will be completed successfully.

The specification calls it ‘intentionally non-committal’. You might see APIs using this response
for for example asynchronous batch processing. HTTP doesn’t have a standard way to
communicate after a request if a request eventually succeeded. An API using this might use
some other facility later to do this.

For example, it might send an email to a user telling them that the batch process worked, or it
might expose another endpoint in the API that can indicate the current status of a
long-running process.
HTTP Status Message: 203 Non-Authoritative Information

Category: Successful

Explanation:
- What causes the HTTP Status Message?
The response contains the requested resource, but the resource may have been obtained
from another source, and therefore might be unreliable — the server is not vouching for
the validity or authenticity of the resource.

- Situations where you can receive the message.

203 Non-Authoritative Information is a status-code that might be used by a HTTP proxy.


A HTTP Proxy sits in the middle between a client and a server (origin). In some cases a
HTTP Proxy might make changes to the response before it reaches the client.

Perhaps because the Proxy converts the format, or maybe it adds something to the HTML
body.
For these situations a proxy can indicate that it changed something by changing the
status-code to 203.

HTTP Status Message: 204 No Content

Category: Successful

Explanation:
- What causes the HTTP Status Message?
This is sent when the server successfully processed the request, but doesn’t need to return
any content. Most often, this occurs as the result of a DELETE request.

When a 204 request is sent, the user agent (the client or web browser) is specifically not
supposed to change its view.

- Situations where you can receive the message​.


For example, if the request was sent via a form on a page, the response should not cause
the form to be refreshed or for the browser to visit another page — there is not new
content in the request to replace the existing content in the user’s view.

HTTP Status Message: 205 Reset Content

Category: Successful

Explanation:
- What causes the HTTP Status Message?
The 205 response is similar to a 204, but the user agent is supposed to refresh their view
back the the default state of the current document.

- Situations where you can receive the message.

For example, if a user fills out a form, and submits it, a status code of 205 means the
server is asking the browser to clear the form.

HTTP Status Message: 206 Partial Content

Category: Successful

Explanation:
- What causes the HTTP Status Message?
This is used when the server is only sending a portion of the requested resource,
because the user requested to only receive a portion of the resource.

- Situations where you can receive the message.

This occurs when a resource is large enough, or the connection unreliable enough, that the
user agent wants to split the resource into a series of “chunked” requests, as illustrated:
● Client: Give me the first 1/4.
○ Server: 206 Partial Content
● Client: Give me the second
1/4.
○ Server: 206 Partial Content.
● And so on…
○ …and so forth.
These partial requests are made by the client using the range header. They might occur one
after another (to guard against download failure), or all at once in multiple threads (to speed
up download).

Links:

https://www.whoishostingthis.com/resources/http-status-codes/

https://evertpot.com/http/

https://aloneonahill.com/blog/http-status-codes

Vous aimerez peut-être aussi