300 Multiple Choices
The HTTP 300 Multiple Choices status code is returned by the server to indicate more than one response is available for the requested resource. The client is responsible for selecting the option best fitting its requirements.
The response is cacheable by default. To override this behavior, include appropriate Cache-Control headers.
Usage
When the 300 Multiple Choices status code is received, the message body contents differ depending on the request method. A HEAD request includes no message body. For other methods, the body contains a list from which the client selects the most appropriate response.
For non-HEAD responses, the body contains
the list of available choices. The Link
header with rel="alternate" is also used to
identify each option. If a default response exists
or the server has a preferred choice, the
Location header identifies this
preference.
Example
The client requests a resource and the server offers multiple options. The headers include paths to each resource. Because this follows a GET request, the body provides a clickable list of options.
Request
GET /tech-news HTTP/1.1
Host: www.example.re
Response
HTTP/1.1 300 Multiple Choices
Link: </leading/news.html>; rel="alternate"
Link: </bleeding/news.html>; rel="alternate"
Location: </leading/news.html>
Content-Type: text/html
Content-Length: 164
<h2>Choose from one of the following</h2>
<ul>
<li><a href=/leading/news.html>Leading edge</a>
<li><a href=/bleeding/news.html>Bleeding edge</a>
</ul>
Code references
.NET
HttpStatusCode.MultipleChoices
Rust
http::StatusCode::MULTIPLE_CHOICES
Rails
:multiple_choices
Go
http.StatusMultipleChoices
Symfony
Response::HTTP_MULTIPLE_CHOICES
Python3.5+
http.HTTPStatus.MULTIPLE_CHOICES
Java
java.net.HttpURLConnection.HTTP_MULT_CHOICE
Apache HttpComponents Core
org.apache.hc.core5.http.HttpStatus.SC_MULTIPLE_CHOICES
Angular
@angular/common/http/HttpStatusCode.MultipleChoices
Takeaway
The 300 Multiple Choices status code indicates the request succeeded and returns multiple resource options. The server expects the client to engage in reactive negotiation by selecting the link best fitting its needs. A default or server-suggested choice is specified in the Location header.