Playground
Product search — the same filter, three ways
A real /api/products endpoint filters an in-memory catalog. Pick some criteria, then fire the exact same filter as QUERY, GET, and POST to see why QUERY fits.
Build a filter
Category
Brand
Color
Size
Max priceAny
No filter selected — this returns the full catalog.
QUERY
Request
QUERY /api/products
{}Right fit: complex criteria live in a clean JSON body, and QUERY is safe, idempotent & cacheable — a “GET with a body”.
GET
Request
GET /api/products
Works, but every criterion is crammed into the URL — it bloats fast and hits length limits.
POST
Request
POST /api/products
{}Carries the body fine, but POST means “create/change”. Caches and proxies won’t treat it as a repeatable read.