im currently working on a website that has Spring on the backend and Angularjs on the front side, and we discussed the answers to the final answers for handling dialog boxes with an external interface, and I have a question:
Let's say I have an API:
GET : /getstatistics
Request params : fromTime,toTime ( in timestamp format)
And if the client makes a request with invalid parameters, such as a string, what response code should be returned from the server? The body of the HTTP 400 request and response with the message "fromTime and toTime should be in timestamp format" or HTTP 200 with the same message?
I saw some Google APIs, for example Oauth, they return 200 code for a request with an invalid access_token, but in our project my opinion should be HTTP 400 , because Javascript has successful callbacks and errors, is it better for it just to pop up a dialog a red window with a message inside and not with an HTTP 200 code, and then you need to check the contents of the message?
Any advice and opinions are welcome.
Thank!
source
share