DEV Community

Discussion on: 404 status code! Really?

Collapse
 
emman27 profile image
Emmanuel Goh

Going to disagree with this as it's a leaky abstraction, exposing the unnecessary detail of having a database to the calling client.

Whether or not a database is queried to check if the book in fact exists or whether all books are simply static pages (though that's often not feasible) should not actually matter to the client. Unless the API is able to reply the other path of GET /boocs/8c2ba535-5523-47a5-8a72-281c316d5fc4 with a similar response such as

{
  "data": {
    "booc": null
  }
}

then I don't think there's actually full consistency and a clear abstraction being made