Request and Response
Every API call is a request and a response. The client sends a request (method, URL, headers, sometimes a body), and the server sends back a response (status code, headers, body). Status codes: 2xx success, 4xx client mistake, 5xx server error.
// Request
GET /api/users/1 HTTP/1.1
Host: example.com
Accept: application/json
// Response
HTTP/1.1 200 OK
Content-Type: application/json
{ "id": 1, "name": "Daniel" }
// Common status codes
200 OK 201 Created
400 Bad Request 401 Unauthorized
404 Not Found 500 Server Error