REST API
Beginner
1 min read
2xx and 3xx Status Codes
Example
# 200 OK — general success (GET, PUT, PATCH that return body)
HTTP/1.1 200 OK
Content-Type: application/json
{ "id": 42, "name": "Alice" }
# 201 Created — resource was created (POST)
HTTP/1.1 201 Created
Location: /users/42
Content-Type: application/json
{ "id": 42, "name": "Alice", "email": "alice@example.com" }
# 202 Accepted — request accepted, processing async
HTTP/1.1 202 Accepted
Location: /jobs/abc123
{ "jobId": "abc123", "status": "queued", "checkUrl": "/jobs/abc123" }
# 204 No Content — success with no body (DELETE, some PUT/PATCH)
HTTP/1.1 204 No Content
# 206 Partial Content — range request (video streaming, large downloads)
HTTP/1.1 206 Partial Content
Content-Range: bytes 0-1023/50000
Content-Length: 1024
# 301 Moved Permanently — update all links
HTTP/1.1 301 Moved Permanently
Location: https://api.example.com/v2/users/42
# 302 Found — temporary redirect
HTTP/1.1 302 Found
Location: /login
# 304 Not Modified — use cached version
HTTP/1.1 304 Not Modified
ETag: "abc123"