main http code code example
Example 1: http status codes
2xx : SUCCESS
200 OK : success
201 CREATED : successfully added data
204 NO-CONTENT successfully updated or deleted
3xx : REDIRECTION
304 NOT MODIFIED:
4xx : CLIENT SIDE ERROR
400 BAD REQUEST : bad data being sent
401 UNAUTHORIZED :
403 FORBIDDEN :
404 NOT FOUND : the resource does not exists at that location
405 METHOD NOT ALLOWED :
DELETE /api/spartans -->> 405 error
406 NOT ACCEPTABLE
415 Unsupported Media type
if you forget to specify the Content-Type
of Post request body, it will see it as plain text
and it will throw this error if it does not support
5xx : Server side error
500 internal service error
If the server do not have any mapping of the url
requested to handle the action -->> 500
503 SERVICE UNAVAILABLE :
504 GATEWAY TIMEOUT :
Example 2: what should be the error response status for information message
Status-Code =
"100" ; Section 10.1.1: Continue
| "101" ; Section 10.1.2: Switching Protocols
| "200" ; Section 10.2.1: OK
| "201" ; Section 10.2.2: Created
| "202" ; Section 10.2.3: Accepted
| "203" ; Section 10.2.4: Non-Authoritative Information
| "204" ; Section 10.2.5: No Content
| "205" ; Section 10.2.6: Reset Content
| "206" ; Section 10.2.7: Partial Content
| "300" ; Section 10.3.1: Multiple Choices
| "301" ; Section 10.3.2: Moved Permanently
| "302" ; Section 10.3.3: Found
| "303" ; Section 10.3.4: See Other
| "304" ; Section 10.3.5: Not Modified
| "305" ; Section 10.3.6: Use Proxy
| "307" ; Section 10.3.8: Temporary Redirect
| "400" ; Section 10.4.1: Bad Request
| "401" ; Section 10.4.2: Unauthorized
| "402" ; Section 10.4.3: Payment Required
| "403" ; Section 10.4.4: Forbidden
| "404" ; Section 10.4.5: Not Found
| "405" ; Section 10.4.6: Method Not Allowed
| "406" ; Section 10.4.7: Not Acceptable