Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Re : How to to ensure that model was deleted on server

$
0
0
That's how REST APIs work, with the HTTP status telling you what happened to a request. You can return error messages for non 200 status codes...

For a DELETE, a successful response is a 200 or 204 and if it's not successful, the status code you return should match the reason why the model was not deleted.

Here's a flowchart from this SO thread detailing what status is appropriate in any situation.


Based on this it looks like a 500 (Internal Server Error) would be what you want, but 404 would also be valid if you try to delete a model that is already deleted.



Viewing all articles
Browse latest Browse all 3491

Trending Articles