Have you seen real-world bugs caused by choosing PUT instead of POST (or the reverse)? How were they fixed?

Using POST where PUT was appropriate is a common real-world bug source because POST is not idempotent, so retried or duplicated requests, such as from a flaky network or a double-click, can create duplicate records instead of safely repeating the same update.

Key Points

Example

A checkout form using POST for order submission created duplicate orders when a user's network hiccuped and their browser silently retried the request; switching to an idempotent PUT with a client-generated order ID fixed the duplication.

// Make "create order" safe to retry: the client sends a unique key per order
@PostMapping("/orders")
public ResponseEntity<OrderDto> create(@RequestHeader("Idempotency-Key") String key,
                                       @Valid @RequestBody CreateOrder request) {
    Optional<OrderDto> existing = orderService.findByIdempotencyKey(key);
    if (existing.isPresent()) {
        return ResponseEntity.ok(existing.get());        // retry: return the same order
    }
    OrderDto created = orderService.create(request, key); // unique DB constraint on key
    return ResponseEntity.status(HttpStatus.CREATED).body(created);
}

// Alternative: let the client choose the id and use PUT, which is idempotent
@PutMapping("/orders/{orderId}")
public OrderDto createOrReplace(@PathVariable UUID orderId, @RequestBody CreateOrder request) {
    return orderService.upsert(orderId, request);
}

Interview Tip

A concise interview answer is

I've seen POST used for update operations cause duplicate records when a request got retried due to a flaky connection, since POST isn't idempotent. The fix was switching to PUT with a stable resource identifier so retries just repeat the same update safely, and adding idempotency checks for cases where POST for creation was still necessary.

Last updated: 11 November 2026

Previous question: Name five annotations you use to build a REST API in Spring Boot.

Next question: If you have multiple beans of the same type in your Spring application context, how would you handle conflicts using @Autowired and @Qualifier? What potential issues could arise if you mix these annotations incorrectly?

More Spring Boot - Level V (Expert) interview questions

All Spring Boot - Level V (Expert) questions