HTTP status codes: Best way to return error messages on REST services



The correct REST approach for errors is to use the HTTP status codes. There is a bewildering array of them (as you can see here) and you might be surprised to see how many may fit most common situations.

Where to start:

enter image description here

 

I’ve grouped response codes into three rough categories:

status codes key


2XX/3XX:

enter image description here


4XX:

enter image description here


5XX:

enter image description here