On Sat, 15 Nov 2014 09:03:57 GMT, Mathias LANG wrote:
On Fri, 14 Nov 2014 15:19:19 GMT, Flamaros wrote:
On Fri, 14 Nov 2014 12:56:21 GMT, Mathias LANG wrote:
Could you provide more info about your use case / what you are trying to achieve ?
I want display a banner with various messages corresponding to the status code:
200 successfully registered
201 operation failed
409 email already registeredSo you have user-facing code on page A, which will request this API and display the banner according to the API return code, am I right ?
Then you can just throw HTTPStatusException with 201 or 409 in the API. 200 Will be the default. However, you should not use 201 to notice of a failure. 200's are success codes. 400's are for client error, and 500's for server error. So you should probably replace 201 with 400.
You are right, that exactly what I am doing.
For sure I didn't look precisely to the http codes, I don't remember which values I'll have to use.
I think it's better with http status codes cause it's standard instead of my own values in an enum. When reading javascript code it will simpler to understand.