liveBook · Manning

Uniform interface

As explained in The Design of Web APIs, Second Edition

The uniform interface constraint is a REST constraint requiring a consistent and standardized interface for interacting with resources.

The uniform interface is a REST constraint that standardizes interactions around resources, their representations, HTTP methods, and metadata. It gives consumers a predictable way to understand resource capabilities and interpret responses. section 4.8.1

Represent API capabilities as resources and use HTTP methods rather than inventing operation-specific interfaces. This supports usability, security, extensibility, and interoperability, while keeping the API understandable and easier to evolve. section 4.8.2 section 15.6.1

Searching account transactions

Use GET /transactions/{accountId}?transactionId=2501 when the account identifies the resource and query parameters modify or filter it. Mixing accountId and transactionId ambiguously in one query, or replacing the resource with /search-transaction, makes the interface harder to understand and guess. section 9.4.1

Figure 9.4 Choosing user-friendly input data locations in an HTTP request depends on HTTP and common practice. Choosing appropriate locations facilitates the provision and understanding of input data.
figure

Use the request-location guide to compare path, query, header, and body choices for predictable HTTP operations. section 9.4.1

Apply the constraint by:

  • Representing meaningful business concepts as appropriately sized resources. section 15.6.1
  • Choosing input locations that follow HTTP behavior and common practice. section 9.4.1
  • Combining the interface with ready-to-use data, flexible flows, and content negotiation to reduce breaking changes. section 15.6.1

How The Design of Web APIs, Second Edition covers it

How deep it goes
Explains the constraint, applies it to input locations and resource design, and connects it to flexibility without detailing implementation internals.
Examples
Uses transaction search paths and query parameters, resource-oriented operation design, and request input-location comparisons.
What it assumes
Assumes familiarity with HTTP and API resources while defining the REST constraint and its role in API design.
What you can do after
Apply it via HTTP resource design and input placement to create APIs that consumers can understand, use, and evolve.
How it connects
Connects REST, resources, representations, HTTP methods, metadata, interoperability, content negotiation, and breaking-change reduction.

Also explained in

Compare how 2 books explain uniform interface →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of The Design of Web APIs, Second Edition. The section links point to the parts of the book it draws on.