HTTP Methods Explained

An overview of common HTTP methods, explaining how each one is typically used and which success and error status codes they most often returns when interacting with web APIs

Here is a list of possible HTTP methods that can be use and their possible response codes.

MethodTypical useSafeIdempotentSuccess codesCommon error codes
GETRead a resource / listYesYES200 OK → return representation
206 Partial ContentRange requests
304 Not Modified → conditional GET/HEAD cache validation
400 Bad Request → invalid query params
401 Unauthorized → not authenticated
403 Forbidden → authenticated but not allowed
404 Not Found → resource doesn’t exist
416 Range Not Satisfiable → invalid range
HEADGET metadata only (no body)YesYes200 OK → headers as-if GET
304 Not Modified → conditional HEAD
Same as GET (commonly 400/401/403/404)
POSTCreate subordinate resource / submit commandNoNo201 Created → new resource created (+ Location)
200 OK → action succeeded + response body
202 Accepted → async processing started
204 No Content → success, nothing to return
400 Bad Request → invalid payload
401/403 auth failures
409 Conflict → violates current state (duplicate, etc.)
415 Unsupported Media Type → wrong Content-Type
422 Unprocessable Content → syntactically valid but semantically invalid
429 Too Many Requests → rate-limited (often with Retry-After)
PUTCreate/replace resource at known URINoYes201 Created → created at target URI 200 OK → replaced + return representation
204 No Content → replaced, no body
400 Bad Request
401/403
404 Not Found → target collection/parent missing (API choice)
412 Precondition Failed → If-Match / conditional failed
415/422 content type or semantic validation failures(optional)
428 Precondition Required → server requires conditional update
PATCHPartial update (apply “patch document”)NoNo*200 OK → patched + return representation
204 No Content → patched, no body (common)
400 malformed patch doc
415 unsupported patch format (+ Accept-Patch)
404 target missing (when patch can’t apply to null resource)
409 conflicting state
412 precondition failed when using If-Match
422 unprocessable change
DELETEDelete a resourceNoYes200 OK → deleted + return body (optional)
204 No Content → deleted, no body
202 Accepted → async deletion
401/403
404 not found
409 conflict (e.g., cannot delete due to state/constraints)
OPTIONSDiscover capabilities / CORS preflightYesYes200 OK → return capabilities in headers/body
204 No Content → headers only
405 method not allowed (if OPTIONS disabled)
TRACEDiagnostic loop-back (rare; often disabled)YesYes200 OK → returns received request (diagnostic) 405 often blocked
CONNECTEstablish a tunnel (proxies; HTTPS via proxy)NO(no)2xx → tunnel established (commonly 200)407 proxy auth required (via Proxy-Authenticate)

srnyapathi
srnyapathi
Articles: 41