Restaurant Update Design

In REST APIs, PUT operations typically require the complete representation of the resource being updated.

Since our update operation needs the same fields as our create operation, we can optimize our code by reusing the existing RestaurantCreateUpdateRequest domain object.

Service Layer Interface

Our service layer needs to accommodate the update operation through the RestaurantService interface.

We'll add the updateRestaurant method which takes two parameters:

  • The restaurant ID to identify which restaurant to update
  • The update request containing the new restaurant details
public interface RestaurantService { // ... // New update method Restaurant updateRestaurant(String id, RestaurantCreateUpdateRequest restaurant); }

The method returns the updated Restaurant entity, allowing clients to see the result of their update operation.

Summary

  • Update operations require complete resource representation in REST
  • Added updateRestaurant method to RestaurantService interface
© 2026 Devtiro Ltd. All rights reserved