Skip to content

Instantly share code, notes, and snippets.

@lazypower
Created November 30, 2012 15:06
Show Gist options
  • Save lazypower/4176286 to your computer and use it in GitHub Desktop.
Save lazypower/4176286 to your computer and use it in GitHub Desktop.
RESTful HTTP Response Codes
Recently I have been building RESTful APIs in Ruby on Rails so I decided to compile a list of HTTP Status Codes to use. This is just a guideline.
Successful Responses:
200 (OK) – everything is fine
201 (Created)– resource successfully created
202 (Accepted) – the call returned but the request was queued up. Somewhat async behavior. Unclear how to communicate error, possibly through the resource state
204 (No Content) – A successful DELETE
Unsuccessful Responses:
400 (Bad Request) – the request could not be understood
401 (Unauthorized Access) – need to authenticate the client
404 (Not found) – the resource was not found, for requests like /resource/id
415 (Unsupported Media Type) – wrong content type in either “Content-Type” header or “Accept” header
422 (Un-processable Entity) – The request had right content type and the request was understood but the logic of the app prevented it from being complete
500 (Server Error) – something bad happened on the server, unexpected error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment