Bird
0
0

Identify the error in this REST API endpoint for deleting a user: DELETE /deleteUser/789

medium📝 Debug Q14 of 15
Rest API - URL and Resource Design
Identify the error in this REST API endpoint for deleting a user: DELETE /deleteUser/789
AMissing query parameter for user ID
BUsing a verb 'deleteUser' in the resource path
CUsing DELETE method instead of GET
DUsing plural noun instead of singular
Step-by-Step Solution
Solution:
  1. Step 1: Check resource naming conventions

    Resource paths should be nouns, not verbs or actions.
  2. Step 2: Analyze the given endpoint

    The path '/deleteUser/789' incorrectly includes the verb 'deleteUser' instead of just '/users/789'.
  3. Final Answer:

    Using a verb 'deleteUser' in the resource path -> Option B
  4. Quick Check:

    Resource path must be noun, not verb [OK]
Quick Trick: Avoid verbs in paths; use HTTP methods for actions [OK]
Common Mistakes:
MISTAKES
  • Including action verbs in URL paths
  • Confusing HTTP method with URL naming
  • Using query parameters unnecessarily

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes