Often in distributed systems, service providers offer machine-readable metadata that describes how clients should bind to and interact with services. For example, you would normally use interface definition languages (IDLs) such as Web Services Description Language (WSDL) for WS-* Web Services, or CORBA-IDL when implementing CORBA systems. On the Web, various metadata technologies are used to describe service contracts, including URI templates, which describe syntactic patterns for the set of URIs that a service supports.
When used properly, URI templates can be an excellent tool for solution designers. As we discuss in later chapters, they are particularly useful for internal service documentation.
When used poorly, URI templates increase coupling between systems and lead to brittle integration. In subsequent chapters, we’ll see how hypermedia greatly reduces the necessity to share URI templates outside services.
A service advertising URI templates encourages its consumers to construct URIs that can be used to access the service’s functionality. As an example, let’s take Restbucks, which exposes ordering information through URI-addressable resources, such as http://restbucks.com/order/1234.
To a web developer, it should be intuitive that changing the number after the final / character in the URI will probably result in another resource representation being returned for a different order. It’s easy to determine how to vary the contents of a simple ...