Sunday, March 22, 2026

Web API | Http Status Codes

 HTTP Status Code Families

1xx – Informational
  • Request received, processing continues
  • Rarely used in practice
  • Example: 100 Continue

2xx – Success
  • Request was successfully processed
  • Most common success responses
  • Examples:
    • 200 OK → Standard success
    • 201 Created → Resource created
    • 204 No Content → Success, no response body

3xx – Redirection
  • Further action needed to complete request
  • Client must follow redirect
  • Examples:
    • 301 Moved Permanently
    • 302 Found (Temporary Redirect)
    • 304 Not Modified → Cache use

4xx – Client Errors
  • Problem with the request (client-side issue)
  • Examples:
    • 400 Bad Request → Invalid input
    • 401 Unauthorized → Authentication required
    • 403 Forbidden → Access denied
    • 404 Not Found → Resource doesn’t exist

5xx – Server Errors
  • Server failed to fulfill a valid request
  • Examples:
    • 500 Internal Server Error → Generic failure
    • 502 Bad Gateway → Invalid upstream response
    • 503 Service Unavailable → Server overloaded/down
    • 504 Gateway Timeout → Upstream timeout

No comments:

Post a Comment

Node | Cluster Vs Worker Threads

Cluster: Multiple processes (scale app across CPU cores) Worker Threads: Multiple threads (handle CPU-heavy work inside one process) Cluster...