Query parameters in action
Add options to URLs and customize what you get back
⏱ Est. ~6 min
01 · Read
Query parameters are how you customize what the server sends back.
They go after the ? in a URL. Each one is key=value. Multiple are separated by &.
The server treats them like options on a form — filter by this, sort by that, limit to N records.
Key points
- The query string starts with ?
- Parameters are key=value pairs
- Multiple parameters are joined with &
- What each parameter means is defined by the server — you can't make them up
02 · Terminal exercise
Try passing your name as a query parameter. The server will greet you by name.
(This section is interactive — please enable JavaScript.)
03 · Terminal exercise
Now add a second parameter. Multiple parameters are separated by & (the ampersand).
(This section is interactive — please enable JavaScript.)
04 · Quiz
How are multiple query parameters separated in a URL?
- With an ampersand &
- With a comma
- With a space
- With a semicolon
05 · Fill in the blank
Query parameters begin after the URL path with the _____ character.
06 · Terminal exercise
Query parameters can also do pagination — limiting how many records you get.
(This section is interactive — please enable JavaScript.)
07 · Quiz
You're using curl to send a URL that has & in the query string. What happens if you don't wrap the URL in quotes?
- The request works normally
- The shell treats & as background execution and the command breaks
- curl automatically adds quotes for you
- The server ignores the & character
08 · Fill in the blank
Multiple query parameters in a URL are separated by the _____ character.
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.