Batch Update Patterns with REST API
📖 Scenario: You are building a simple REST API for a bookstore. The store wants to update the prices of multiple books at once to run a sale.Batch updates let you change many items in one request, saving time and effort.
🎯 Goal: Create a batch update endpoint that accepts a list of book IDs and new prices, then updates the prices in the data store.
📋 What You'll Learn
Create a data structure to hold books with their IDs and prices
Add a configuration variable for the discount percentage
Write the batch update logic to apply the discount to selected books
Print the updated books after the batch update
💡 Why This Matters
🌍 Real World
Batch updates are common in online stores to quickly change prices or stock for many products at once.
💼 Career
Understanding batch update patterns helps backend developers build efficient APIs that handle multiple changes in one request.
Progress0 / 4 steps