Server, are you okay?
502 Bad Gateway — I
I’m not getting couldn’t reach the
response. upstream server!
Client
Server
HTTP METHODS
AND STATUS
CODES: A
POCKET GUIDE
HTTPS://BUILDYOURSKILLACADEMY.COM
BUILD YOUR SKILL ACADEMY
HTTP METHODS (CRUD OPERATIONS)
Method Purpose Usage Example Idempotent
GET Retrieve data /users (Get all users) ✅ Yes
POST Create data
/users (Add new
user)
❌ No
PUT
Update data (full
update)
/users/1 (Update user
#1)
✅ Yes
PATCH
Update data
(partial update)
/users/1 (Update user
name)
✅ Yes
DELETE Remove data
/users/1 (Delete user
#1)
✅ Yes
HEAD
Retrieve headers
only
/users (Only
metadata)
✅ Yes
Retrieve
OPTIONS supported /users ✅ Yes
methods
https://buildyourskillacademy.com
BUILD YOUR SKILL ACADEMY
HTTP STATUS CODES
🟢 SUCCESS CODES (2XX)
Code Meaning Description
Request succeeded,
200 OK Success
response included.
201 Resource A new resource has
Created Created been created.
202 Processin Request accepted but
Accepted g not yet completed.
204 No Success, Request successful, no
Content No Data content returned.
https://buildyourskillacademy.com
BUILD YOUR SKILL ACADEMY
HTTP STATUS CODES
🟡 CLIENT ERROR CODES (4XX)
Code Meaning Description
400 Bad Invalid The server cannot process the
Request Request request.
401 Authentication
Missing/invalid authentication.
Unauthorized Needed
403 Access
Client lacks permission.
Forbidden Denied
404 Not Resource
Requested resource not found.
Found Missing
405 Method Invalid Method not supported by the
Not Allowed Method endpoint.
429 Too Many Rate Limit
Client sent too many requests.
Requests Exceeded
https://buildyourskillacademy.com
BUILD YOUR SKILL ACADEMY
HTTP STATUS CODES
🔴 SERVER ERROR CODES (5XX)
Code Meaning Description
500 Internal The server encountered an
Generic Error
Server Error error.
502 Bad Invalid Server received an invalid
Gateway Response response from upstream.
503 Service Overloaded/ Server is temporarily unable to
Unavailable Down handle requests.
504 Gateway Server timed out waiting for an
Timeout
Timeout upstream response.
https://buildyourskillacademy.com
BUILD YOUR SKILL ACADEMY
💡 4. BEST PRACTICES FOR
HTTP METHODS AND STATUS CODES
✅ USE CORRECT METHODS: FOLLOW HTTP
SPECIFICATIONS (GET FOR RETRIEVAL, POST FOR
CREATION).
✅ RETURN MEANINGFUL STATUS CODES: DON’T
RETURN 200 OK FOR EVERYTHING.
✅ HANDLE ERRORS GRACEFULLY: PROVIDE
DETAILED ERROR RESPONSES (E.G., ERROR
CODES, DESCRIPTIONS).
✅ SECURE SENSITIVE ENDPOINTS: USE 401 AND
403 APPROPRIATELY.
✅ DOCUMENT YOUR APIS: CLEARLY OUTLINE
EACH ENDPOINT'S METHOD AND EXPECTED
STATUS CODES.
https://buildyourskillacademy.com
FOLLOW US
TO GET MORE
INFORMATION
LIKE THIS.
https://buildyourskillacademy.com SAVE