Skip to content
Ameen Abozaid
Planned lessonJNR-020-L04

Filtering

  • Lesson 4 of 6
  • Junior
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 (minPrice not greater than maxPrice).
  • Filtering works together with paging and sorting.
  • Allow only filters you documented; ignore or reject unknown ones consistently.
Draft outline details

Demonstration

java
@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.

Lab and exercises Quiz

Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.

Continue to next lesson

Type to search levels, phases, modules and lessons.