Service API Patterns, Protocols, Coupling Types, Metrics > Service API Design Patterns > Lightweight Endpoint
Lightweight Endpoint
How can lightweight units of business logic be positioned as effective and reusable enterprise resources?
A service consumer that requires access to business entity information (such as data about an invoice) needs to maintain two identifiers: one for the service and another for the invoice itself. The business entity identifier may be unique only within the scope of the service API, and the service consumer may be limited to using unnecessarily coarse-grained service capabilities pre-defined as part of the published service API. This can result in wasteful data exchange and consumer-side processing.
The Lightweight Endpoint pattern can be applied to expose data and functionality associated with business entities as a series of granular lightweight endpoints, allowing consumers to target those endpoints in order to optimize data exchange and consumer-side processing. This pattern is based on the resource-centric view of business entities and artifacts provided by the REST framework involved.
In this example, the Invoice service is returning resource representations at various levels of granularity to the Invoice Printer service playing the service consumer role. This ability is enabled by lightweight endpoints that provide varying levels of access to parts of individual business entities or collections of business entities.