The products endpoint is public — no authentication needed. This makes it perfect for practicing GET requests with query parameters.
curl BASE_URL/productsTry each of these commands one by one to see how filters work:
curl "BASE_URL/products?category=electronics"curl "BASE_URL/products?search=headphones"curl "BASE_URL/products?minPrice=1000&maxPrice=5000"curl "BASE_URL/products?sort=price&order=asc"curl "BASE_URL/products?page=2&limit=5"Combine multiple filters in one request: BASE_URL/products?category=electronics&sort=price&order=desc&limit=3
| Parameter | Example | Description |
|---|---|---|
| category | electronics | Filter by category (electronics, clothing, books, home, sports) |
| brand | SoundMax | Filter by brand name |
| search | wireless | Search in name, description, brand, tags |
| minPrice | 1000 | Minimum price |
| maxPrice | 5000 | Maximum price |
| inStock | true | Only in-stock products |
| sort | price | Sort by: price, name, rating, createdAt |
| order | asc | Sort direction: asc or desc |
| page | 2 | Page number (default: 1) |
| limit | 5 | Items per page (default: 10) |
Fetch details for a single product by its ID. Use any product ID from the list (e.g., prod-1).
curl BASE_URL/products/prod-1Expected response (200 OK):
{
"success": true,
"data": {
"id": "prod-1",
"name": "Wireless Bluetooth Headphones",
"price": 2499,
"category": "electronics",
"brand": "SoundMax",
"stock": 45,
"rating": 4.5
}
}1. Find all electronics under Rs 5,000 using category and price filters.
2. Find all books sorted by price from low to high.
3. Get page 3 of products with 3 items per page. Check the meta object for pagination info.
Q: What are query parameters in a REST API?
A: Query parameters are key-value pairs appended to the URL after a ? symbol, separated by &. They are used to filter, sort, paginate, or modify the response without changing the resource path. Example: /products?category=books&sort=price.