Bird
0
0

In a REST API, how would you sort a list of users by their username in ascending order?

easy📝 Conceptual Q2 of 15
Rest API - Query Parameters and Filtering
In a REST API, how would you sort a list of users by their username in ascending order?
A/users?sort=-username
B/users?sort=username
C/users?order=username
D/users?filter=username
Step-by-Step Solution
Solution:
  1. Step 1: Identify the correct syntax for ascending sort

    Using sort=username sorts results by username in ascending order.
  2. Step 2: Understand the meaning of other options

    Prefix '-' means descending, order and filter are not standard for sorting.
  3. Final Answer:

    /users?sort=username -> Option B
  4. Quick Check:

    Ascending sort = sort=username [OK]
Quick Trick: No minus sign means ascending sort [OK]
Common Mistakes:
  • Using '-' for ascending order
  • Using 'order' or 'filter' instead of 'sort'
  • Confusing filter with sort

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes