Bird
0
0

Identify the error in this REST API design: POST /updateUser/123

medium📝 Debug Q14 of 15
Rest API - URL and Resource Design
Identify the error in this REST API design: POST /updateUser/123
AUser ID should not be in the URL
BHTTP method POST cannot be used with user resources
CURL contains a verb 'update', which should be avoided
DURL should end with a question mark
Step-by-Step Solution
Solution:
  1. Step 1: Check URL naming conventions

    URLs should use nouns to represent resources, not verbs like 'update'. The verb should be expressed by the HTTP method.
  2. Step 2: Analyze the given URL

    The URL /updateUser/123 contains the verb 'update', which violates REST best practices.
  3. Final Answer:

    URL contains a verb 'update', which should be avoided -> Option C
  4. Quick Check:

    Verbs in URL = URL contains a verb 'update', which should be avoided [OK]
Quick Trick: Avoid verbs in URLs; use HTTP methods for actions [OK]
Common Mistakes:
  • Putting verbs like 'update' in URLs
  • Misusing HTTP methods
  • Ignoring resource identification in URLs

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes