Chapter 6

Design Request and Response Message Representations

Having defined API endpoints and their operations in the previous chapter, we now look into the request and response messages that the API clients and providers exchange. These messages are a key part of the API contract; they bring or break interoperability. Large and rich messages might be very informative, but they also add runtime overhead; small and terse messages might be efficient to transport, but they might not be understood easily and may cause clients to emit follow-up requests to fully satisfy their information needs.

We start with a discussion of related design challenges and then introduce patterns responding to these challenges. The patterns are presented in two sections, ...

Get Patterns for API Design: Simplifying Integration with Loosely Coupled Message Exchanges now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.