Contents
How do I get past 404 not found?
How to Fix the 404 Not Found Error
- Retry the web page by pressing F5, clicking/tapping the refresh/reload button, or trying the URL from the address bar again.
- Check for errors in the URL.
- Move up one directory level at a time in the URL until you find something.
- Search for the page from a popular search engine.
Should API return 404 or empty list?
The 404 status code should be reserved for situations, in which a resource is not found. In this case, your resource is a collection of users. This collection exists but it’s currently empty.
Why 404 is client-side error?
Cause of HTTP 404 Errors Technically, an Error 404 is a client-side error, implying that it’s your mistake, either because you typed the URL incorrectly or the page has been moved or removed from the website and you should have known.
When do you need to return a body in an API?
If you design your API in such a way that it always returns a sensible response code, you might not even need to return a body when the resource was not found. That said, returning a body, especially a humanly readable one, can’t hurt.
When to return 404 in RESTful API design?
And the more appropriate response code to communicate that the request went through normally, but the requested resource is not available at the moment is the venerable 404. If you design your API in such a way that it always returns a sensible response code, you might not even need to return a body when the resource was not found.
What should I expect from a RESTful API?
The first thing to consider, since you are building a RESTful API, is to return an appropriate response code. And the more appropriate response code to communicate that the request went through normally, but the requested resource is not available at the moment is the venerable 404.
When to return an empty array in API?
This approach also answers your question. You should return an empty array when the query does not match: On the other hand, if you try to get a specific movie resource with GET api/movie/34 and that movie does not exist, then return 404 with a suitable (json encoded) error message in the body