Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RESTful API response status code disambiguation

I'm developing a RESTful API and have a question about the most appropriate response status codes for certain scenarios.

Consider the case where the client makes a GET request for a resource. How can I disambiguate a "not found" response for the case where the resource legitimately does not exist, vs. the case where there may be a minor service interruption (during deployment, etc).

like image 400
anthony Avatar asked Dec 08 '22 06:12

anthony


1 Answers

The W3C defines very specific status codes for nearly all cases you can think of. For your specific needs:

  • Not Found: 404
  • Service Unavailable: 503
like image 134
SingleShot Avatar answered Dec 13 '22 22:12

SingleShot