Beyond the method and URL, requests carry extra information through headers and parameters. Knowing the difference is essential for building and testing requests correctly.
Headers
Headers are metadata sent with the request or response. Common ones include:
- Content-Type — the format of the body (e.g. application/json).
- Accept — the format the client wants back.
- Authorization — credentials such as a token.
Path vs query parameters
Path parameters
Identify a specific resource, built into the URL path.
/users/42— user with id 42.- Required; part of the address.
Query parameters
Filter, sort, or paginate, added after a ?.
/users?role=admin&page=2- Usually optional; refine the request.
Test idea: check that path parameters correctly select resources (including invalid ids returning 404), and that query parameters filter and paginate as documented.
Conclusion
Headers carry metadata like content type and authentication, while path and query parameters target and refine the resource you are requesting. Handling each correctly — and testing them — is key to reliable API calls.