Bird
0
0

How would you filter a list of books to only those published between 2010 and 2020 using query parameters?

hard📝 Application Q9 of 15
Rest API - URL and Resource Design

How would you filter a list of books to only those published between 2010 and 2020 using query parameters?

Apublished=2010-2020
Bpublished_gt=2010&published_lt=2020
Cpublished_between=2010,2020
Dpublished_after=2010&published_before=2020
Step-by-Step Solution
Solution:
  1. Step 1: Use greater than and less than filters for range

    To filter between two dates, use published_gt=2010 and published_lt=2020.
  2. Step 2: Check other options for standard query param syntax

    Options B and C use unsupported syntax; D uses non-standard keys.
  3. Final Answer:

    published_gt=2010&published_lt=2020 -> Option B
  4. Quick Check:

    Use _gt and _lt for range filtering [OK]
Quick Trick: Use _gt and _lt to filter ranges in query params [OK]
Common Mistakes:
MISTAKES
  • Using unsupported combined range syntax
  • Assuming 'between' is a valid param
  • Using non-standard parameter names

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes