Skip to content

Instantly share code, notes, and snippets.

@david-pm
Created February 19, 2015 04:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save david-pm/7cdc2a904bea3a73b02a to your computer and use it in GitHub Desktop.
Save david-pm/7cdc2a904bea3a73b02a to your computer and use it in GitHub Desktop.
HTTP
200 OK -
General status code. Most common code used to indicate success.
201 CREATED -
Successful creation occurred (via either POST or PUT).
Set the Location header to contain a link to the newly-created resource (on POST).
Response body content may or may not be present.
204 NO CONTENT -
Indicates success but nothing is in the response body, often used for DELETE and PUT operations.
400 BAD REQUEST -
General error when fulfilling the request would cause an invalid state.
Domain validation errors, missing data, etc. are some examples.
401 UNAUTHORIZED -
Error code response for missing or invalid authentication token.
403 FORBIDDEN -
Error code for user not authorized to perform the operation or the resource is
unavailable for some reason (e.g. time constraints, etc.).
404 NOT FOUND -
Used when the requested resource is not found, whether it doesn't exist or if there was a
401 or 403 that, for security reasons, the service wants to mask.
405 METHOD NOT ALLOWED -
Used to indicate that the requested URL exists, but the requested HTTP method is not applicable.
For example, POST /users/12345 where the API doesn't support creation of resources this way (with a provided ID). The Allow HTTP header must be set when returning a 405 to indicate the HTTP methods that are supported. In the previous case, the header would look like "Allow: GET, PUT, DELETE"
409 CONFLICT -
Whenever a resource conflict would be caused by fulfilling the request. Duplicate entries, such as trying to create two customers with the same information, and deleting root objects when cascade-delete is not supported are a couple of examples.
500 INTERNAL SERVER ERROR -
Never
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment