Bird
0
0

What is wrong with the REST API URL: /products/45//reviews?

medium📝 Debug Q6 of 15
Rest API - URL and Resource Design
What is wrong with the REST API URL: /products/45//reviews?
AIt contains a double slash which can cause routing errors
BThe resource name 'products' should be singular
CThe ID '45' should be placed after 'reviews'
DThe URL should end with a query parameter
Step-by-Step Solution
Solution:
  1. Step 1: Identify the URL structure

    The URL is /products/45//reviews, which contains a double slash between '45' and 'reviews'.
  2. Step 2: Understand URL syntax rules

    Double slashes in the path segment are invalid and can cause routing or parsing errors in REST APIs.
  3. Final Answer:

    It contains a double slash which can cause routing errors -> Option A
  4. Quick Check:

    Check for consecutive slashes in URL paths [OK]
Quick Trick: Avoid double slashes in URL paths [OK]
Common Mistakes:
MISTAKES
  • Assuming resource names must be singular
  • Thinking IDs should be after sub-resources
  • Believing URLs must end with query parameters

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes