title: REST API 404: Bad URI, or Missing Resource?
body: <p>I'm building a REST API, but I've encountered a problem.</p>
  
  <p>It seems that accepted practice in designing a REST API is that if the resource requested doesn't exist, a 404 is returned.</p>
  
  <p>However, to me, this adds unnecessary ambiguity. HTTP 404 is more traditionally associated with a bad URI. So in effect we're saying <em>"Either you got to the right place, but that specific record does not exist, <strong>or</strong> there's no such location on the Internets! I'm really not sure which one..."</em></p>
  
  <p>Consider the following URI:</p>
  
  <pre><code>http://mywebsite/api/user/13
  </code></pre>
  
  <p>If I get a 404 back, is that because User 13 does not exist? Or is it because my URL <em>should</em> have been:</p>
  
  <pre><code>http://mywebsite/restapi/user/13
  </code></pre>
  
  <p>In the past, I've just returned a NULL result with an <code>HTTP 200 OK</code> response code if the record doesn't exist. It's simple, and in my opinion very clean, even if it's not necessarily accepted practice. But is there a better way to do this?</p>