Reading an HTTP Request: The Four Parts Every API Call Has
When an API call fails, it usually is not something deep. A token was missing, a field name was spelled wrong, or the call went to the wrong address. The answer was in the request and the reply the whole time.
What a request looks like
POST /customers HTTP/1.1
Host: api.example.com
Authorization: Bearer <your-token>
Content-Type: application/json
{
"first_name": "Sara",
"last_name": "Khan",
"email": "sara@example.com"
}Example request. This is the shape, not a real endpoint.
The first line says what to do and where. Then come the headers, an empty line, and sometimes a body. The body carries the data, for calls like POST and PATCH. The reply has the same layout, with a status code on its first line.
Read it in this order
- Method and URL. Is it the right action on the right thing? Check both against the docs.
- Headers. Is the token there? Does Content-Type say application/json when you send JSON?
- Body. Are the field names spelled exactly like the docs? first_name is not firstName. Copy them from the docs.
- Response. Read the status code first, then the error message. It often tells you exactly what is wrong.
A header that caught meMy LinkedIn scheduler sent a header saying which LinkedIn API version it wanted, written straight into the code. LinkedIn retires old versions, so one day it would stop working. The bug was in one header line.
Do this in 60 secondsPress F12 in your browser, open the Network tab and reload any page. Click one request. Find the method, the URL, the status code and the headers.
Today’s AI angleAn AI agent can only fix what it can see. If your tool returns only "request failed", it will guess. Give it the status code and the error body, and it can fix the field and try again.