Bird
0
0

Identify the error in this REST API request URL that tries to sort users by age in descending order:

medium📝 Debug Q14 of 15
Rest API - Query Parameters and Filtering

Identify the error in this REST API request URL that tries to sort users by age in descending order:

https://api.example.com/users?sort=age&direction=descending
AThe parameter 'direction' should be 'desc' not 'descending'.
BThe 'sort' parameter should be 'desc' instead of 'age'.
CThe URL is missing the 'order' parameter.
DThe '&' symbol should be replaced with '?' in the URL.
Step-by-Step Solution
Solution:
  1. Step 1: Check the 'direction' parameter value

    The correct values for direction are 'asc' or 'desc', not 'descending'.
  2. Step 2: Confirm the 'sort' parameter is correct

    'sort=age' is correct to specify sorting by age.
  3. Final Answer:

    The parameter 'direction' should be 'desc' not 'descending'. -> Option A
  4. Quick Check:

    Use 'desc' for descending direction [OK]
Quick Trick: Use 'desc' not 'descending' for direction [OK]
Common Mistakes:
MISTAKES
  • Using full word 'descending' instead of 'desc'
  • Changing 'sort' parameter incorrectly
  • Misplacing '&' and '?' in URL

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes