PDA

View Full Version : Determine success via HTTP status codes(restful ajax)



meediake
28 Apr 2011, 3:46 PM
Hello!

Is it possible to avoid using "success" property in response contents(all kinds of stores for combos, grids etc) and rely on HTTP status codes (2xx, 3xx, 4xx) instead? I know that I can make just ajax requests without it and it works.

I am developing a restful application and this "success" property does not make any sense in the overall logic of my app.

Best regards
Sigmar

kendoctor
28 Apr 2011, 6:05 PM
but, extjs's restful is enough for me. i use php symfony mvc. The colletion route config match all extjs's request's url.
only one status code 200 there, so, others will be bad results.
if you want to check state in client further, i think you can pass a custome property in response to processs your requirements.

wardrop
29 Jan 2013, 7:16 PM
I would also like to know how to base success off of the HTTP status code. This is the most graceful method of handling server-side issues, as it can handle anything from a validation problem, to a full application crash. If you're application crashes or something else unexpected happens, you don't get the opportunity to return JSON, let alone JSON with a special property.

I'm currently looking at the JSON Reader and Ajax proxy classes to see if I can inherit from them and change this behaviour.

ohcibi
6 Oct 2014, 9:35 AM
Is there any progress on that? I totally agree that it makes absolutely no sense to include a property in the jsons response to indicate success state. The HTTP status code are made for exactly that. A Store that is called a "REST"Store should behave Restful.