← Back to Chapters

HTTP Status Code 300 – Multiple Choices

? HTTP Status Code 300 – Multiple Choices

? Quick Overview

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.

? Key Concepts

  • Part of the 3xx Redirection class of status codes
  • Server provides multiple resource options
  • Client decides which representation to use
  • Often includes a list of URLs or formats

? Syntax / Theory

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.

? Code Example(s)

? View Code Example
// 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>

? Live Output / Explanation

What Happens?

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.

? Interactive Example

Click the button below to simulate requesting a resource that has multiple formats (HTML, JSON, XML).

300 Multiple Choices Found
Server: "I have 3 versions of this file. Which one do you want?"
 
? View Logic Code
// 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...
}

?️ Use Cases

  • Content negotiation (HTML, JSON, XML)
  • Language-based resource selection
  • File download with multiple formats
  • API version selection

✅ Tips & Best Practices

  • Always provide clear alternatives in the response body
  • APIs should document how clients choose options
  • Avoid using 300 unless multiple valid choices truly exist

? Try It Yourself

  • Create a mock API that returns 300 for multiple formats
  • Test browser vs API client behavior
  • Log how different clients handle the response