Correct HTTP codes for query errors

Respond with HTTP 400 for queries with multiple or no results, as
specified in the documentation