Challenge - 5 Problems
REST API Filtering Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
What is the output of this REST API filter query?
Given an API endpoint that returns a list of users, the query
?age=30 filters users by age. What will be the JSON response if the database has users with ages 25, 30, and 35?Rest API
GET /users?age=30
Response body:Attempts:
2 left
💡 Hint
Filtering by age=30 returns only users with age exactly 30.
✗ Incorrect
The filter query
?age=30 returns only users whose age field equals 30. Only Alice matches this.❓ Predict Output
intermediate2:00remaining
What does this REST API filter return?
An API supports filtering products by price range using
?min_price=10&max_price=20. If products have prices 5, 10, 15, 20, and 25, which products are returned?Rest API
GET /products?min_price=10&max_price=20 Response body:
Attempts:
2 left
💡 Hint
The filter includes products with price between 10 and 20 inclusive.
✗ Incorrect
The filter returns products priced at 10, 15, and 20. Prices 5 and 25 are outside the range.
🔧 Debug
advanced2:00remaining
Why does this filter query return an error?
A REST API supports filtering users by status with
?status=active. The client sends ?status=activ and gets a 400 error. Why?Rest API
GET /users?status=activ
Attempts:
2 left
💡 Hint
Check if the filter value matches allowed values exactly.
✗ Incorrect
The API validates filter values strictly. 'activ' is a typo and not recognized, so it returns 400.
❓ Predict Output
advanced2:00remaining
What is the output of this complex filter query?
An API supports filtering orders by date range and status:
?start_date=2023-01-01&end_date=2023-01-31&status=shipped. Given orders with various dates and statuses, which orders are returned?Rest API
GET /orders?start_date=2023-01-01&end_date=2023-01-31&status=shipped Response body:
Attempts:
2 left
💡 Hint
Filters combine to return orders shipped in January 2023 only.
✗ Incorrect
Only orders with status 'shipped' and dates in January 2023 are returned.
🧠 Conceptual
expert3:00remaining
Which option best describes filtering by nested field values in REST APIs?
You want to filter a list of books by the author's country, where author is a nested object. Which approach is correct?
Attempts:
2 left
💡 Hint
Some APIs allow dot notation in query parameters for nested fields.
✗ Incorrect
Many REST APIs support nested filtering using dot notation in query parameters, like
?author.country=USA.