4 ms·
No, the "completely invalid query" is 400. 404 is only for "the request makes sense but that specific resource doesn't exist".
by wool_gather 7y ago
No, the "completely invalid query" is 400.
404 is only for "the request makes sense but that specific resource doesn't exist".
- paulddraper 7y ago400 is a very generic error. It is often used to complain about problems with the request body. Considering how brief the HTTP RFC is, your interpretation is I think as good as any, if very uncommon. (Not what Django, Rails, Flask, etc. do).
- akvadrako 7y agoIn this case it’s a 404 because the query URL pattern doesn’t exist - the most common cause of 404s.
- pavel_lishin 7y agoSame thing, no? If I ask for /api/user/238885 and I get a 404 back, it's because the resource "user" with ID of 238885 doesn't exist. If I ask for /api/banana/wharrgarbl, it's because the resource "banana" with the ID of "wharrgarbl" doesn't exist.