| I very intentionally avoided the REST vs HTTP RPC debate. This is _specifically_ about HTTP APIs. REST is not a synonym for HTTP but there are much better resources out there that rant on about the important of hypertext and URL support etc. This is mostly about the perspective of consumers. >It does not matter too much which part of the URL is the one that is causing the URL to be wrong. Your consumer disagrees, they'd like to know if their URL was fat fingered or if a record was missing. My argument is 404 is inappropriate because the web service exists, but the record doesn't. > Thus `api/v11/employees/1` and `/api/v1/employees/100` both are wrong resources. I can't say this is wrong, but it doesn't feel right. `/api/v11` straight up resolves to nowhere. Maybe this an instance where Gone is better than Not Found? > Nobody is stoppping anyone to add response body to a 404 to indicate which nested resource is invalid. That can be added as a debug message for the developer for example. 100% agreed. It's just a thought I had while debating with my team. I posted this here for this exact kind of feedback :D good points raised |
So I will focus on HTTP then.
Say you install an nginx/apache and then have a static structure where you have the profiles of employees saved as PDFs directly on the disk.
Then you do `GET /public/v1/employees/1.pdf` and it works returns 200 with the content. Then you do `GET /public/v11/employees/1.pdf` in this case all servers will return 404. The same goes for `GET /public/v1/employees/100.pdf` will still be 404. What if someone asks for `GET /public/v1/employeea/1.pdf` the server will again respond with 404.
Then I go and I implement an webapp to replace that. I plan to keep the URLs the same but now there is an app that will return the .PDF as a datastream or file.
For me, I don't see any reason why to change the behaviour of the URLs just because I replaced a static app with a dynamic web app. Any HTTP server will respond in the same way thus the current one should respond the same.
Responding like this has a compatibility (let's say) reason behind that is not a personal nor related specifically to my project.