Skip to content

Instantly share code, notes, and snippets.

@patwey
Last active April 15, 2017 21:36
Show Gist options
  • Save patwey/59e24b6997316a4c3fe706a4b7efe9d5 to your computer and use it in GitHub Desktop.
Save patwey/59e24b6997316a4c3fe706a4b7efe9d5 to your computer and use it in GitHub Desktop.
Common HTTP status codes, their description and their place in a RESTful API

HTTP Status Codes

2xx Success

200 OK
  • The request has succeeded
  • Routes:
    • GET index
    • GET show
201 Created
  • The request has been fulfilled and resulted in a new resource
  • Routes:
    • POST create
204 No Content
  • The request has been fulfilled but the server does not need to return an entity-body
  • Routes:
    • PUT update
    • DELETE destroy

4xx Client Error

400 Bad Request
  • The request could not be understood due to malformed syntax
  • Routes:
    • All routes
401 Unauthorized
  • The request requires user authentication, the client may repeat the request with a suitable Authorization header
  • Routes:
    • All routes
404 Not Found
  • The server has not found anything matching the Request-URI
  • Routes:
    • GET show
    • PUT update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment