The 300 Multiple Choices HTTP status code indicates that a requested resource has more than one possible representation, and the client must choose one. This typically occurs when content negotiation is involved.
When a client sends a request, the server may respond with 300 Multiple Choices along with a list of alternatives. The response body can contain links to each option.
// Example of a 300 Multiple Choices HTTP response
HTTP/1.1 300 Multiple Choices
Content-Type: text/html
<html>
<body>
<h1>Multiple Choices</h1>
<p>Choose one of the available formats.</p>
</body>
</html>
The client receives a response telling it that multiple versions of the resource exist. A browser may display a list, while APIs usually require explicit client handling.
Click the button below to simulate requesting a resource that has multiple formats (HTML, JSON, XML).
// JavaScript simulation of handling a 300 status code
if(response.status === 300){
console.log("Multiple resource choices available");
// Logic to let user pick a format...
}