Updated Jun 19, 2026

HTTP & JSON: the API Building Blocks

You keep hearing that an app "calls an API" — and somewhere a request goes out, some data comes back, and a screen fills with results. It can feel like magic happening behind a curtain. It isn't. Almost every web API you'll ever touch is built from exactly two things: HTTP, the way the message travels, and JSON, the way the data is written down. Learn those two, and the curtain disappears — you'll be able to read an API call and actually understand what's going on.

This guide is the calm walkthrough of those two building blocks. No framework, no SDK, no special tools — just curl in a terminal so you can see the raw request and the raw response with nothing in the way.

⏭️ Brand new to the whole idea of an API? Read What an API Is first, then come back here.

How to read this

  • Want it to finally make sense? Read in order. Phase 1 recaps the transport (HTTP), Phase 2 teaches the data format (JSON), and Phase 3 puts them together in real calls. Each phase builds on the last.
  • Already comfortable with HTTP? You can skim Phase 1 and start at Phase 2: JSON, the Data Format.

The phases

  1. HTTP, the Transport — how a web API rides on HTTP: request and response, the methods (GET/POST/...), status codes, and headers — focused on the API angle. An annotated GET request, start to finish.
  2. JSON, the Data Format — what JSON actually is (objects, arrays, strings, numbers, booleans, null), why it won, and how to read and write it. With the mental map from JSON to objects in your code, and the punctuation gotchas that bite everyone.
  3. A Real API Call — the two halves together: curl a JSON API and read what comes back, then send a POST with a JSON body and the right headers. Annotated transcripts of both.

This guide deliberately stays at "the two building blocks." The deeper mechanics of HTTP (caching, connections, cookies, HTTPS) live in HTTP Explained. How APIs are organized into resources and conventions is the job of REST APIs Explained, which this guide sets you up for.