Bird
0
0

Identify the error in this REST API call: /api/items?sort=price&direction=ascending

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

Identify the error in this REST API call: /api/items?sort=price&direction=ascending

AThe 'sort' parameter is missing
BThe 'direction' value should be 'asc' instead of 'ascending'
CThe URL should use POST method
DThe 'direction' parameter should be 'desc'
Step-by-Step Solution
Solution:
  1. Step 1: Check the 'direction' parameter value

    Standard REST APIs expect 'asc' or 'desc' for direction, not 'ascending'.
  2. Step 2: Confirm the correct value

    Replace 'ascending' with 'asc' to fix the syntax.
  3. Final Answer:

    The 'direction' value should be 'asc' instead of 'ascending' -> Option B
  4. Quick Check:

    Use 'asc' or 'desc' for direction values [OK]
Quick Trick: Use 'asc' not 'ascending' for direction [OK]
Common Mistakes:
MISTAKES
  • Using full words instead of 'asc'/'desc'
  • Missing 'sort' parameter
  • Wrong HTTP method

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes