Bird
0
0

Which of the following URLs follows the best practice of avoiding verbs in REST API design?

easy📝 Conceptual Q11 of 15
Rest API - URL and Resource Design
Which of the following URLs follows the best practice of avoiding verbs in REST API design?
A<code>/createUser</code>
B<code>/getUser/123</code>
C<code>/deleteUser/123</code>
D<code>/users/123</code>
Step-by-Step Solution
Solution:
  1. Step 1: Understand URL naming conventions

    REST APIs should use nouns to represent resources, not verbs. URLs like /users/123 represent a user resource with ID 123.
  2. Step 2: Identify verbs in URLs

    URLs like /getUser/123, /createUser, and /deleteUser/123 contain verbs (get, create, delete), which is against best practice.
  3. Final Answer:

    /users/123 -> Option D
  4. Quick Check:

    Use nouns in URLs = /users/123 [OK]
Quick Trick: Use nouns for URLs, verbs go in HTTP methods [OK]
Common Mistakes:
MISTAKES
  • Including verbs like 'get' or 'delete' in the URL
  • Using action words instead of resource names
  • Confusing HTTP methods with URL paths

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes