Reading API docs
Translate any API doc entry into a working curl command
⏱ Est. ~7 min
01 · Read
The skill isn't memorizing APIs. It's being able to read any API's documentation and translate it into a working request in 2 minutes.
Every API has docs. The format varies, but the structure is consistent: - Method + path — what request to send - Path parameters — values embedded in the URL path - Query parameters — optional filters and options - Request body — what JSON to send for POST/PUT - Response — what you'll get back
Key points
- Path parameters like {owner} get substituted directly into the URL path
- Query parameters go after ?, and any without "required" are optional
- Request body fields for POST/PUT are sent with -d '{...}'
- Always read the "Authentication" section of the docs first
02 · Code example
Let's read a real GitHub API documentation entry together.
API doc entry
GET /repos/{owner}/{repo}/issues
Path parameters:
owner (string, required) — account owner of the repository
repo (string, required) — name of the repository
Query parameters:
state (string) — "open", "closed", or "all" — default: "open"
labels (string) — comma-separated label names
per_page (integer) — results per page, max 100, default 30
page (integer) — page number of results
Response: Array of issue objects
Translated to curl command
# Get all CLOSED issues for facebook/react, 10 per page
curl "https://api.github.com/repos/facebook/react/issues?state=closed&per_page=10"
Translation process: 1. Method = GET → no -X flag needed 2. Base URL = https://api.github.com 3. Path = /repos/{owner}/{repo}/issues → replace {owner} with facebook, {repo} with react 4. Query params = ?state=closed&per_page=10 5. Public repos don't need authentication
03 · Real-machine exercise
Try it yourself. Run this command to get closed issues for facebook/react.
curl "https://api.github.com/repos/facebook/react/issues?state=closed&per_page=5"
04 · Fill in the blank
API docs say GET /repos/{owner}/{repo}/commits. To get commits from the torvalds/linux repo, the URL path becomes: /repos/___/linux/commits
05 · Real-machine exercise
Now put it all together. Translate this docs entry into a complete curl command: GET /repos/{owner}/{repo}/commits Query: author (GitHub username), per_page (max 100) Task: get the 5 most recent commits from torvalds/linux, no author filter.
curl "https://api.github.com/repos/torvalds/linux/commits?per_page=5"
06 · Quiz
API docs say: GET /users/{userId}/orders?status=pending&limit=50. You want to fetch orders for user ID 42, with status pending, limited to 10 records. What's the correct path?
- /users?userId=42/orders?status=pending&limit=10
- /users/{42}/orders?status=pending&limit=10
- /users/42/orders?status=pending&limit=10
- /users/42/orders&status=pending&limit=10
07 · Fill in the blank
When API docs say GET /repos/{owner}/{repo}/commits, the parts in curly braces like {owner} are called _____ parameters.
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.