Your first real API
Call JSONPlaceholder from your real terminal — a free public API
⏱ Est. ~11 min
01 · Read
Up to now you've been calling a mock API. Now let's call a real one.
JSONPlaceholder (jsonplaceholder.typicode.com) is a free public fake API used by millions of engineers for testing and learning. No signup, no API key, no credit card.
It has real endpoints, real JSON responses, and behaves exactly like a production API — the perfect tool for practice.
Key points
- JSONPlaceholder is free, public, and requires no authentication
- It has endpoints for users, posts, todos, comments, albums, and photos
- Responses are fake data, but the format is identical to a real API
- This lesson uses your real machine's terminal (not the sandbox)
02 · Real-machine exercise
Open your real terminal (not the sandbox). Confirm curl is available. Windows PowerShell users: use curl.exe instead of curl for every command in this lesson.
curl --version
03 · Real-machine exercise
Fetch a single todo. This is a real GET request to a real server.
curl https://jsonplaceholder.typicode.com/todos/1
04 · Real-machine exercise
Fetch all users. This returns an array of 10 user objects — scroll through the JSON and look at the structure.
curl https://jsonplaceholder.typicode.com/users
05 · Read
Look at what you've done so far: you confirmed curl is installed, fetched a single resource, and fetched a batch of users from a live server on the internet. Every response is structured JSON — the same format real apps use every day.
Next you'll go further. You'll learn how to filter results with query parameters (so you don't have to download the whole batch), and how to create new resources with POST requests. These two patterns power most of the apps on your phone.
06 · Real-machine exercise
Filter with query parameters: fetch only posts by user ID 1.
curl "https://jsonplaceholder.typicode.com/posts?userId=1"
07 · Real-machine exercise
POST a new resource. JSONPlaceholder accepts POST requests and returns the "created" resource (with an ID) — but doesn't actually save it.
curl -X POST https://jsonplaceholder.typicode.com/posts \
-H "Content-Type: application/json" \
-d '{"title": "My First Post", "body": "Hello from curl!", "userId": 1}'08 · Quiz
What is JSONPlaceholder?
- A JavaScript library
- A database service
- A free fake API used for testing and learning
- A code editor
09 · Fill in the blank
In the terminal, the _____ command lets you call HTTP APIs from the command line.
Other lessons in this chapter
⚠ The full interactive experience needs JavaScript. Please enable it and reload.
※ This is an independent Traditional Chinese teaching project — not an official Anthropic product. Claude™ is a trademark of Anthropic, PBC.