title: Most appropriate HTTP status code for “malformed identifier”
body: <p>Given we have a web service that takes numerical identifiers.  What is the generally most agreed upon HTTP Status Code for an invalid (non-numerical) identifier?</p>
  
  <p><strong>Valid Resource Identifier</strong></p>
  
  <blockquote>
    <p><em>Request</em>: GET <a href="http://service.co.uk/resources/123" rel="nofollow">http://service.co.uk/resources/123</a></p>
    
    <p><em>Response</em>:   200 OK</p>
  </blockquote>
  
  <p><strong>Valid but Unknown Resource Identifier</strong></p>
  
  <blockquote>
    <p><em>Request</em>: GET <a href="http://service.co.uk/resources/456" rel="nofollow">http://service.co.uk/resources/456</a></p>
    
    <p><em>Response</em>:   404 Not Found</p>
  </blockquote>
  
  <p><strong>Invalid Resource Identifier</strong></p>
  
  <blockquote>
    <p><em>Request</em>: GET <a href="http://service.co.uk/resources/abc" rel="nofollow">http://service.co.uk/resources/abc</a></p>
    
    <p><em>Response</em>:   400 Bad Request</p>
  </blockquote>
  
  <p>In the event of an invalid identifier, 404 (Not Found) accurately describes the situation; we failed to locate the resource.  However 400 (Bad Request) gives an indication as to why the resource was not found.</p>
  
  <p>RFC 2616</p>
  
  <blockquote>
    <p>10.4.1 400 Bad Request</p>
    
    <p>The request could not be understood by the server due to malformed
    syntax. The client SHOULD NOT repeat the request without
    modifications.</p>
    
    <p>10.4.5 404 Not Found</p>
    
    <p>The server has not found anything matching the Request-URI. No
    indication is given of whether the condition is temporary or
    permanent. The 410 (Gone) status code SHOULD be used if the server
    knows, through some internally configurable mechanism, that an old
    resource is permanently unavailable and has no forwarding address.
    This status code is commonly used when the server does not wish to
    reveal exactly why the request has been refused, or when no other
    response is applicable.</p>
  </blockquote>