Which status code should I use for failed validations or invalid duplicates?

For input validation failure: 400 Bad Request + your optional description. This is suggested in the book “RESTful Web Services”. For double submit: 409 Conflict Update June 2014 The relevant specification used to be RFC2616, which gave the use of 400 (Bad Request) rather narrowly as The request could not be understood by the server … Read more

HTTP status code for update and delete?

For a PUT request: HTTP 200, HTTP 204 should imply “resource updated successfully”. HTTP 201 if the PUT request created a new resource. For a DELETE request: HTTP 200 or HTTP 204 should imply “resource deleted successfully”. HTTP 202 can also be returned by either operation and would imply that the instruction was accepted by … Read more

403 Forbidden vs 401 Unauthorized HTTP responses

A clear explanation from Daniel Irvine [original link]: There’s a problem with 401 Unauthorized, the HTTP status code for authentication errors. And that’s just it: it’s for authentication, not authorization. Receiving a 401 response is the server telling you, “you aren’t authenticated–either not authenticated at all or authenticated incorrectly–but please reauthenticate and try again.” To … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)