Bird
0
0

You want to design a REST API for a library system. Which URI design best follows resource-based design thinking to access all books by author ID 77?

hard📝 Application Q8 of 15
Rest API - REST API Fundamentals
You want to design a REST API for a library system. Which URI design best follows resource-based design thinking to access all books by author ID 77?
A/books/authors/77
B/authors/77/books
C/books?author=77
D/getBooksByAuthor/77
Step-by-Step Solution
Solution:
  1. Step 1: Understand nested resource URIs

    Accessing books by author uses nested resources: author resource then books collection.
  2. Step 2: Evaluate options

    /authors/77/books clearly shows the relationship. Options A, B, and D are less clear or non-standard.
  3. Final Answer:

    /authors/77/books -> Option B
  4. Quick Check:

    Nested resources = /parent/id/child [OK]
Quick Trick: Use nested URIs to show resource relationships [OK]
Common Mistakes:
MISTAKES
  • Using query parameters instead of nested URIs
  • Adding verbs in URI paths
  • Confusing resource hierarchy

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes