Bird
0
0

You want to fetch a list of active users created after 2023-01-01 using a GET request. Which URL is the best choice?

hard📝 Application Q15 of 15
Rest API - HTTP Methods
You want to fetch a list of active users created after 2023-01-01 using a GET request. Which URL is the best choice?
AGET /users?status=active&created_after=2023-01-01
BGET /users/active/2023-01-01
CPOST /users with body {"status":"active","created_after":"2023-01-01"}
DGET /users {"status":"active","created_after":"2023-01-01"}
Step-by-Step Solution
Solution:
  1. Step 1: Choose correct HTTP method and URL format

    GET is used to read data. Query parameters are the standard way to filter resources in GET requests.
  2. Step 2: Analyze options for filtering

    GET /users?status=active&created_after=2023-01-01 uses query parameters to filter by status and creation date, which is the correct RESTful approach.
  3. Final Answer:

    GET /users?status=active&created_after=2023-01-01 -> Option A
  4. Quick Check:

    GET + query filters = correct usage [OK]
Quick Trick: Use query parameters to filter GET requests [OK]
Common Mistakes:
  • Using POST instead of GET for reading
  • Putting filters in URL path incorrectly
  • Sending body with GET request

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes