HTTP Request Structure

An HTTP request consists of a method, target URI, protocol version, headers, and optionally a body.

POST /api/users HTTP/1.1
Host: api.example.com
Content-Type: application/json
Authorization: Bearer eyJ...

{
  "name": "Suriya",
  "email": "suriya@example.com"
}

The method communicates the intended operation. Headers carry metadata. The body carries representation data when appropriate.

The URL itself can contain a path and query string. For example, /users/42?include=orders identifies user 42 while providing an optional query parameter.

Raw HTTP Request
GET /api/users/42?include=orders HTTP/1.1
Host: api.example.com
Accept: application/json
Authorization: Bearer TOKEN

The request asks the server for user 42 and indicates that orders should also be included.

Key Takeaways
  • Methods express intent.

  • Headers carry metadata.

  • The body carries representation data.

  • Query parameters modify retrieval or filtering behavior.