I’m creating some restful apis. There is a “register” api, user can POST an “email” and “name” and “password” to register.
On the server side, I will check if the email has been used first. What http code shall I response if I found the email has already been used?
I response 400(bad request) for now, but I don’t know if it’s correct.
400 Bad Requestis correct since there’s no specific HTTP code for validation errors.In a REST API, in general you only ever need to return four HTTP error codes: