Bird
0
0

Identify the error in this URL used to filter users by age and city:

medium📝 Debug Q14 of 15
Rest API - URL and Resource Design

Identify the error in this URL used to filter users by age and city:
api/users?age=30&city;=NewYork

AThe semicolon ';' is incorrectly used instead of '='
BThe '&' should be replaced with '?' between parameters
CThe city value should be URL encoded as 'New%20York'
DThe age parameter should be 'age_gt=30' to filter correctly
Step-by-Step Solution
Solution:
  1. Step 1: Check parameter separators and assignments

    Parameters are separated by '&' and assigned with '='. Here, 'city;=NewYork' uses ';' wrongly.
  2. Step 2: Confirm correct syntax

    The semicolon should be '=' to assign the value to 'city'.
  3. Final Answer:

    The semicolon ';' is incorrectly used instead of '=' -> Option A
  4. Quick Check:

    Use '=' to assign values, not ';' [OK]
Quick Trick: Use '=' for assignment, '&' to separate parameters [OK]
Common Mistakes:
  • Using semicolon instead of equal sign
  • Replacing '&' with '?' between parameters
  • Not encoding spaces in values

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes