HTTP status codes are an essential part of web communication, indicating the result of a client’s request to a server. Here’s an expanded list of status codes, their meanings, and how to use them in a Rails API.
✅ HTTP Status Code Cheat Sheet
Category | Code | Symbol | Meaning | Description |
---|---|---|---|---|
1xx – Informational | 100 | :continue | Continue | Request received, continue processing |
1xx – Informational | 101 | :switching_protocols | Switching Protocols | Protocol switch accepted |
2xx – Success | 200 | :ok | OK | Request succeeded |
2xx – Success | 201 | :created | Created | Resource created successfully |
2xx – Success | 204 | :no_content | No Content | Success, no content returned |
3xx – Redirection | 301 | :moved_permanently | Moved Permanently | Resource moved to a new URI |
3xx – Redirection | 302 | :found | Found | Resource temporarily moved |
3xx – Redirection | 304 | :not_modified | Not Modified | Use cached version |
4xx – Client Error | 400 | :bad_request | Bad Request | Malformed request syntax |
4xx – Client Error | 401 | :unauthorized | Unauthorized | Auth required |
4xx – Client Error | 403 | :forbidden | Forbidden | Access denied |
4xx – Client Error | 404 | :not_found | Not Found | Resource not found |
4xx – Client Error | 405 | :method_not_allowed | Method Not Allowed | HTTP method not supported |
4xx – Client Error | 422 | :unprocessable_entity | Unprocessable Entity | Validation errors |
5xx – Server Error | 500 | :internal_server_error | Internal Server Error | Generic server error |
5xx – Server Error | 502 | (no symbol) | Bad Gateway | Invalid upstream response |
5xx – Server Error | 503 | :service_unavailable | Service Unavailable | Server temporarily overloaded |
5xx – Server Error | 504 | (no symbol) | Gateway Timeout | Upstream timeout |
ℹ️ For the full list of symbols supported by Rails, visit the Rails Response Status Documentation.