4

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).

2 Answers 2

9

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
Sign up to request clarification or add additional context in comments.

Comments

6

Send a 404 status code for "Not found"

Send some 500-series error for error conditions on the server-side.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.