Skip to main content
junior
beginner
Networking

HTTP Methods and Status Codes

Question

What are the main HTTP methods and what do common status codes like 200, 404, and 500 mean?

Answer

The main HTTP methods are: GET (retrieve data), POST (create data), PUT (update/replace data), PATCH (partial update), and DELETE (remove data). Status code 200 means success, 201 means created, 301/302 are redirects, 400 is bad request, 401 is unauthorized, 403 is forbidden, 404 is not found, and 500 is internal server error. Understanding these is essential for API troubleshooting.

Why This Matters

HTTP is the foundation of web communication. DevOps engineers troubleshoot APIs, configure load balancers, set up monitoring, and read access logs daily. Knowing HTTP methods and status codes helps quickly diagnose issues and communicate with developers effectively.

Code Examples

Test HTTP endpoints with curl

bash
Common Mistakes
  • Using GET requests to modify data
  • Not checking response status codes in scripts
  • Confusing 401 (authentication) with 403 (authorization)
Follow-up Questions
Interviewers often ask these as follow-up questions
  • What is the difference between PUT and PATCH?
  • What does a 502 Bad Gateway error typically indicate?
  • What is the difference between 401 and 403 status codes?
Tags
http
api
web
networking
troubleshooting