freecoding.school100% FREE · NO SIGNUP
Endpoint BayISSUE #18 of 45

filtering · sorting · query params

RestaVSThe 401 Bandit
Resta saysFiltering and sorting refine list endpoints via query parameters.

Let clients narrow results with query params: ?status=active&role=admin filters, ?sort=-created_at sorts (a - prefix often means descending), and ?fields=id,name trims the payload. Define a consistent grammar across endpoints so clients learn it once. This keeps responses small and lets the server do the work efficiently.

Power-ups you unlock

The 401 Bandit attacks — common mistakes

Boss battleDesign query params to list active users sorted by newest, name + email only.

Example code

<!doctype html><html><head><meta charset="utf-8"></head>
<body style="background:#06040d;color:#e6e0ff;font-family:monospace;padding:20px"><pre>GET /users?status=active&amp;sort=-created_at&amp;fields=name,email</pre></body></html>
▶ Open the interactive comic issue
‹ Pagination · Offset · Cursor · KeysetVersioning · /V1/ · Headers · Subdomains ›