Bird
0
0

You want to filter a list of employees to get only those with salary greater than 50000 and department 'HR'. Which URL query string correctly applies both filters?

hard📝 Application Q8 of 15
Rest API - Query Parameters and Filtering
You want to filter a list of employees to get only those with salary greater than 50000 and department 'HR'. Which URL query string correctly applies both filters?
A/employees?salary_gt=50000&department=HR
B/employees?salary>50000&department=HR
C/employees?salary=50000&department=HR
D/employees?salary_gt=50000|department=HR
Step-by-Step Solution
Solution:
  1. Step 1: Use correct filter operators and separators

    "salary_gt=50000" means salary greater than 50000; '&' separates multiple filters.
  2. Step 2: Check other options for syntax errors

    Unencoded '>' causes URL parsing errors, '=' provides exact match instead of greater-than, '|' is an invalid separator instead of '&'.
  3. Final Answer:

    /employees?salary_gt=50000&department=HR -> Option A
  4. Quick Check:

    Use _gt and & for multiple filters [OK]
Quick Trick: Use _gt/_lt and & to combine filters correctly [OK]
Common Mistakes:
  • Using unencoded special characters
  • Using wrong separators like |
  • Using equals for range filters

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes