Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
HTTP DELETE: HTTP 200, 202 or 204 All the Time? (tugberkugurlu.com)
8 points by tugberk on June 25, 2014 | hide | past | favorite | 2 comments


> I received 404 because /api/cars/3 is not a URI which points to a resource in my system.

I don't think returning 404 in this case is a good idea. If a client wants to know if a resource exists or not, they'll issue a HEAD or GET request.

However, for a DELETE request, they normally simply want to delete it and knows that it has been done. Whether the resource has been deleted now or was already deleted doesn't provide any useful information. So returning 200 in all cases (unless it really cannot be deleted) should do it and will keep the API simpler.


yes, I think the same way. That was just an example.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: