title: REST API Accept header json/pdf
body: <p>I'm currently working with an API, which I would think is doing a wrong implementation of a REST API.</p>
  
  <p>We have the following endpoints</p>
  
  <ol>
  <li>GET v1/{organizationId}/invoices</li>
  <li>GET v1/{organizationId}/invoices/{guid}</li>
  </ol>
  
  <p>When you GET the first, you get all invoices, but if you get the second endpoint, without the <code>Accept: Application/json</code> header, you get the response from the first endpoint instead.</p>
  
  <p>The company, which provides the API, says the reason for this is because the second endpoint can give both JSON and a PDF output, which would seem as a PDF would be</p>
  
  <pre><code>GET v1/{organizationId}/invoices/{guid}/pdf
  </code></pre>
  
  <p>Besides that, if send a malformed <code>guid</code>, you get a full blown HTML 404 error page instead of, e.g., a blank page or an error message.</p>
  
  <p>To sum it up</p>
  
  <ol>
  <li>Is the 2. endpoint handled properly?</li>
  <li>Is it valid to make PDF an output like JSON/XML?</li>
  <li>Shouldn't it be a new endpoint instead?</li>
  <li>Is HTML allowed as an error response, even for a malformed request? </li>
  </ol>