Stop Building CRUD APIs: 5 Task-Based Patterns Senior Engineers Use Instead

How to stop exposing your database schema over HTTP and start building APIs that speak your domain’s language?

Press enter or click to view image in full size

CRUD APIs expose database tables over HTTP; task‑based APIs expose business processes. Instead of a single PUT /orders/42 where the client directly mutates the status, a senior API defines intent‑driven endpoints like POST /orders/{id}/cancel or POST /orders/{id}/ship

This keeps validation, state‑transition logic, inventory release, refunds, and notifications inside the server, eliminating scattered business rules and preventing invalid operations (e.g., cancelling a delivered order).

The API models what the user actually wants to accomplish, not how the data is stored.

The Problem with “One Update Endpoint for Everything”

Most Spring Boot tutorials produce an API that looks like this:

// ❌ Generic update — the client mutates state, the server persists it
@PutMapping("/orders/{id}")
public Order updateOrder(@PathVariable Long id,
@RequestBody Order order) {
return orderService.update(id, order);
}

This is one method doing the work of an entire business process. Cancellation, confirmation, and…

Similar Posts

Leave a Reply