Noun-based Resource Naming in REST API
📖 Scenario: You are building a simple REST API for a bookstore. The API should use noun-based resource names to represent collections and individual items.
🎯 Goal: Create a REST API endpoint structure using noun-based resource naming conventions for books and authors.
📋 What You'll Learn
Create a list called
books with three book titles as stringsCreate a variable called
resource_name and set it to the string "books"Use a for loop with variable
book to iterate over books and create a list called book_resources with URLs in the format "/books/{book_id}" where book_id is the index starting from 1Print each URL in
book_resources on a new line💡 Why This Matters
🌍 Real World
REST APIs use noun-based resource names to clearly represent collections and individual items, making URLs easy to understand and consistent.
💼 Career
Understanding noun-based resource naming is essential for backend developers and API designers to create clean, maintainable, and user-friendly APIs.
Progress0 / 4 steps