HTTP Response Structure
An HTTP response contains a status code, headers, and optionally a response body.
HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: max-age=60
{
"id": 42,
"name": "Suriya"
}
The status code communicates the broad result of the operation. Headers provide metadata about caching, content type, authentication challenges, rate limits, cookies, and other behavior.
A good API uses status codes consistently rather than returning 200 OK for every situation.
Response Components
Status:
200 OKCommunicates the outcome at the HTTP protocol level.
Headers:
Content-Type, Cache-ControlDescribe metadata and processing instructions.
Body:
JSON representationContains the returned resource or result.