Bird
0
0

You want to search for books published after 2010 and written by 'Alice' using a REST API. Which URL correctly uses search parameters?

hard📝 Application Q8 of 15
Rest API - Query Parameters and Filtering

You want to search for books published after 2010 and written by 'Alice' using a REST API. Which URL correctly uses search parameters?

A/api/books?author=Alice&year_gt=2010
B/api/books?author=Alice&year>2010
C/api/books?author=Alice&year=2010
D/api/books?author=Alice&year<2010
Step-by-Step Solution
Solution:
  1. Step 1: Identify correct parameter for 'after 2010'

    Using year_gt=2010 means year greater than 2010, which matches the requirement.
  2. Step 2: Check other options for syntax and logic

    A uses invalid character < in URL and less than 2010 (wrong direction), B uses invalid >, C equals 2010 (not after).
  3. Final Answer:

    /api/books?author=Alice&year_gt=2010 -> Option A
  4. Quick Check:

    Use _gt for greater than in parameters [OK]
Quick Trick: Use _gt for greater than in search params [OK]
Common Mistakes:
  • Using > symbol directly in URL
  • Using = instead of greater than

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes