October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk6 min

API Design: Keep Read Models Separate From Write Contracts

A screen-ready GET response does not have to become a broad update contract. Shape API writes around ownership, permissions, workflow, and unambiguous change intent.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A useful API can return a single, screen-ready view of a customer without accepting that same broad object as an update. Reads may combine information for convenience; writes should reflect who owns each field, who may change it, and what rules apply. When an update omits a property, the server must also know whether that means “leave it alone” or “clear it”—a distinction a broad, loosely defined write model can obscure.

Why a combined read should not dictate an update

A GET response is often designed for a client’s needs: one request can provide a customer’s name, contact details, subscription status, and other information in a single representation. That is a useful read view, but it does not mean every field belongs in one writable resource.

As an Amazon Associate I earn from qualifying purchases.

Fields in that response may have different owners, permissions, and workflows. A display name and phone number might be ordinary profile data; changing an email address might trigger verification; a verification flag may be controlled only by the server; and deactivation may have operational consequences. Giving every caller one broad update body can blur those boundaries and grant write access that the caller should not have.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The design principle is to compose reads when that helps clients, while shaping writes around the rules for changing the underlying data. This resembles a read/write split often associated with CQRS, but it can use ordinary HTTP resources rather than requiring a separate architecture.

#1 Best Overall
API Design Patterns
  • API Design Patterns
  • ABIS BOOK
  • Manning Publications

Make each write’s intent unambiguous

An update needs to distinguish several intentions: leave a field unchanged, set it to a value (including 0, false, or an empty string), clear it, or change one member of a collection. A request model that treats an omitted property and an explicit null as the same value cannot reliably express all of them.

  • If the server ignores null values, a client may have no way to clear a field.
  • If the server replaces the resource, an omitted field may be cleared even though the client meant to leave it alone.
  • If a client resends an entire collection to change one element, it can overwrite another change made concurrently.

Partial updates can express intent more precisely, but only if the client preserves which fields the user actually changed. That information can be lost as form values pass through view models, data-transfer objects, service layers, or generated SDKs. Comparing a loaded document with an outgoing one is not always a safe substitute: mapping defaults into the outgoing model can make untouched fields look changed.

Choose a write shape that fits the data

Use PUT for a small, cohesive resource

A complete-resource PUT works well when the resource is small, its writable fields share the same ownership and authorization rules, and the client can send every writable field. The request should include the complete set of writable fields; a nullable field can be explicitly set to null to clear it. To leave the resource unchanged, the client can make no request or send the current values.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

This approach is a poor fit for a wide aggregate whose fields have different permissions, owners, or workflows. Treating omission as “unchanged” while also claiming to replace a complete resource makes the contract harder to reason about.

Use a patch format for document-like data when it suits the contract

PATCH is not inherently a bad choice. Flexible preference documents that acquire arbitrary keys, or large configuration documents, may be better served by a patch format than by a complete PUT. The format determines how changes are represented, but clients still need to know which changes they intend to make.

Format How changes are expressed Important behavior
JSON Patch A sequence of operations on paths in a document Expressive, but array-index paths can target the wrong element after reordering unless guarded with a test operation.
JSON Merge Patch A patch document describing desired changes Simpler, but arrays are replaced as a whole rather than edited item by item.

The PATCH method does not prescribe one request-body format: no single format fits every resource. Field masks and organizational REST guidelines are other published approaches, but practices designed around a particular organization’s generated clients and governance may not transfer directly to every team.

Group writable fields by responsibility

Put fields in the same writable resource when they share an owner, authorization scope, and workflow. For example, a profile resource could accept a display name and phone number together. Email may deserve its own operation if changing it starts verification. A server-owned verification status should not be client-writable. An operational action such as deactivation should be explicit rather than disguised as an ordinary field edit.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

This creates a normalized write surface: each field has a clear place to be changed, and each request body covers the fields of that resource. The read representation can still compose these concerns into one customer view for a screen.

Handle collections and business transitions explicitly

Address identity-bearing collection items individually

When collection elements have identity, give each item its own address so a client can add or remove one without resending the whole collection. For example:

POST /customers/42/tags

can add a tag, while:

DELETE /customers/42/tags/priority

can remove that particular tag. An ordered list with no natural item identity, such as a sequence of steps, may instead remain in the parent resource and be replaced as a unit.

Name operations with business consequences

Use a named operation when a transition has business consequences or several changes must be atomic together. Closing an account might deactivate the customer and cancel a subscription as one operation, because leaving an inactive customer subscribed and billed would violate a business rule. Hiding such a transition inside a field update does not remove the operation; it only makes the contract less explicit.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Account for the costs of a narrower write surface

More calls and partial failures

A screen that edits several independently governed concerns may need several requests. The client must be able to show which changes succeeded and which failed. A batch API can reduce round trips while preserving each operation’s method, URL, body, and result—and the rules of the individual endpoints.

Atomicity

Separate requests can leave an edit partly applied. If changes must succeed together to preserve a business invariant, define an operation that owns the atomic transition rather than relying on a client to coordinate independent writes.

Concurrent edits

Protect complete updates from silently overwriting newer data with a version precondition. A server can return an ETag on GET; the client sends that value in If-Match with PUT. If the version is stale, the server can return 412 Precondition Failed. When a precondition is required but missing, 428 Precondition Required is another possible response.

Contract changes

Adding a required writable field to a complete PUT contract can break older clients that do not send it. Version a writable resource when its request contract changes if compatibility requires it; composed read views can gain fields independently.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Migrate without keeping a back door

  1. Add narrower write endpoints alongside the existing broad update endpoint.
  2. Move clients screen by screen to the endpoint that matches each edit’s ownership, permissions, and workflow.
  3. Apply the same ownership and workflow rules to the old endpoint during the transition, so it cannot bypass the new boundaries.
  4. After traffic has moved, keep the aggregate URL read-only if it remains useful as a composed view.

How to choose an update design

There is no universally best update method. Decide based on the shape and rules of the data, not on the fact that it appears together in a GET response.

  • Are the fields a fixed record or a flexible document?
  • Do they share the same owner, permissions, and workflow?
  • Can clients preserve which fields users actually changed?
  • Do collection elements have identity, or should the collection be replaced as a whole?
  • Must related changes succeed atomically?
  • How much do extra calls, concurrent edits, and future client-contract changes matter?

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.