3 ms·
From the perspective of an HTTP server, a resource either exists, or doesn't. There's no concept of a "valid path". If you do GET /a/b/c, if /a/b/c exists you
by simiones 4y ago
From the perspective of an HTTP server, a resource either exists, or doesn't. There's no concept of a "valid path".
If you do GET /a/b/c, if /a/b/c exists you get a 200, if it doesn't you get a 400 (and if you're not allowed to access it you get a 401 or 403 depending on some other details, and if the server has a problem while replying you get a 500 etc).
This is a very important concept about what an HTTP URL means, and how it is understood by HTTP servers and middle-boxes (caches, proxies etc).
- brightball 4y agoThat’s just it though, the resource does exist. The resource is the API to retrieve a result. The result being empty doesn’t mean the resource doesn’t exist, in the context of an API.
- simiones 4y ago> That’s just it though, the resource does exist. The resource is the API to retrieve a result. That is not true if the API is RESTful - in that case, the API is the resource. An item with the requested URL either exists or doesn't. If it doesn't, then return 404 and (if possible) give some more information.