Bird
0
0

You have an API endpoint /employees that supports filtering by department and active status. How would you get all active employees in the 'sales' department?

hard📝 Application Q15 of 15
Rest API - Query Parameters and Filtering
You have an API endpoint /employees that supports filtering by department and active status. How would you get all active employees in the 'sales' department?
A/employees?department=sales&active=true
B/employees?active=true,department=sales
C/employees?department=sales|active=true
D/employees?department=sales;active=true
Step-by-Step Solution
Solution:
  1. Step 1: Use correct query parameter syntax

    Query parameters are joined by & and use key=value pairs.
  2. Step 2: Combine filters for department and active status

    /employees?department=sales&active=true correctly filters active sales employees.
  3. Final Answer:

    /employees?department=sales&active=true -> Option A
  4. Quick Check:

    Use & to combine filters [OK]
Quick Trick: Combine filters with & and key=value pairs [OK]
Common Mistakes:
  • Using | or ; instead of & to join filters
  • Mixing order of parameters incorrectly
  • Using invalid separators causing syntax errors

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes