Filtering
On This Lesson 4 topics
This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.
In this lesson
let clients narrow a list with query parameters.
Planned topics
- Each filter is a named query parameter:
GET /products?category=3&minPrice=500&maxPrice=2000. - All filters are optional; no filter means no restriction.
- Combine filters with AND. Validate values (
minPricenot greater thanmaxPrice). - Filtering works together with paging and sorting.
- Allow only filters you documented; ignore or reject unknown ones consistently.
Draft outline details
Demonstration
@GetMapping
Page<ProductResponse> list(@RequestParam(required = false) Long category,
@RequestParam(required = false) Long minPrice,
@RequestParam(required = false) Long maxPrice, ...)Check your understanding
What does a missing category parameter mean?
Show answer
Do not filter by category.
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.