liveBook · Manning

Data integrity

As explained in API Design Patterns

Integrity is the property that received data exactly matches the data that was sent and has not been altered in transit.

Data integrity means that received data matches what was sent and has not been altered in transit. In API design, it also means keeping shared facts consistent rather than duplicating conflicting copies across resources. section 30.1.2 section 4.3.3

Apply integrity checks and resource boundaries deliberately:

  • Reject requests whose content changed after sending; origin authentication alone does not prove request integrity. section 30.1.2
  • Treat HTTP method, path, host, and selected body content as the request fingerprint when signing requests. section 30.6
  • Keep shared facts in separate resources when in-lining would require unclear update rules or create stale duplicates. section 4.3.3
  • Use 409 Conflict for duplicate membership additions and 412 Precondition Failed when removing a nonexistent membership. section 15.3.2

Books, authors, and signed requests

A library API can model an Author separately and let Book reference it, so changing an author’s name has one clear update location. If the name is copied into every Book, updates can diverge. Separately, a signed request can protect its method, path, host, and body fingerprint against transit tampering. section 4.3.3 section 30.6

Figure 4.17 Books with Authors as a separate resource

Compare separate Book and Author resources with an in-line author representation to assess duplication and update-consistency risks. section 4.3.3

How API Design Patterns covers it

How deep it goes
Defines tampering, compares network protection with request verification, and explains duplication risks without detailing signing implementation.
Examples
Uses library books and authors, duplicate group membership, and signed HTTP method, path, host, and body content.
What it assumes
Assumes API resources and HTTP requests, while defining integrity and its relationship to request origin from basic terms.
What you can do after
Evaluate resource boundaries, preserve shared-data consistency, and verify or reject modified HTTP requests.
How it connects
Connects integrity with origin authenticity, nonrepudiation, digital signatures, HMAC, TLS, HTTP requests, and resource normalization.

Also explained in

Compare how 18 books explain data integrity →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of API Design Patterns. The section links point to the parts of the book it draws on.