Foreword
FROM THE VERY START OF WHEN I GOT INVOLVED IN COMPUTING, theres been the desire to have software systems designed as components that can be freely combined. The wide-scale connectivity of the Internet fueled this desire, and added the desire to have components operate over networks that introduce issues of latency and unknown reliability. In this world many systems have been tried, and many have failedusually with a whimper.
A great example of success is the World Wide Web. Its success has penetrated both business operations and popular culture. It provides opportunities for people to pull together information from many sources, with hardly any prearranged collaborationand at a global scale.
The Web, as we currently know it, isnt the be-all and end-all of computing, but many people believe it offers an important lesson on how to construct systems of networked components. Many people take advantage of its protocol, HTTP, to connect systems. But some people think we should go further, using HTTP not as a convenient tunnel, but to embrace the way the Web works as a foundation for systems collaboration.
This thinking gathers together under the name of REST. It refers to Roy Fieldings PhD thesis, which is far more often referred to than it is read. There is a growing notion that following the principles of REST offers a fruitful path to making networked components work, one that is built upon the success of the Web itself.
That vision is attractive, but there is much to be done to reach it. We have to take the principles of REST and see how to apply them to the everyday problems of systems integration. This is the task the authors of this book have taken on: to take REST from an attractive vision to implemented systems. Theyve done much to teach me about thinking in resources, how to use HTTP idioms, and the importance of hypermedia controls. As a result, this book will give you a thorough grounding in applying the core elements of RESTful thinking.
As we all should know, REST is not the answer to all questions. There are many situations where a REST approach is an appropriate approach, but many where it is not. As its early days in using this style for integration problems, we are still feeling our way around these boundaries. But in order to explore these boundaries properly, its vital to have a proper understanding of what REST is about. Without that, you run the risk of trying pseudo-REST and drawing the wrong conclusions. This book can help you avoid that fate.
Martin Fowler
August 2010
Preface
THE WEB HAS REVOLUTIONIZED THE WAY WE ACCESS AND SHARE INFORMATION. In just two decades, it has become the global platform for delivering and consuming services.
The pervasiveness and ubiquity of the Web stems from the way it combines architectural simplicity with a small set of widely accepted technologies. The Web provides scalability, security, and reliability for those systems that embrace its simple tenets, and it does so using commodity tools and platforms.
Our goal in this book is twofold: to demystify the Web as an application platform and to showcase how web architecture can be applied to common enterprise computing problems. Throughout the chapters, we make it a point to demonstrate how services can leverage the Web both inside and outside enterprise boundaries. Our vision is of an information platform that is open and available to other systems, which eschews integration in favor of composition, and yet implements valuable business behaviors: a distributed, hypermedia-driven application platform.
You dont have to know REST or HTTP in detail in order to understand this book. Well take you from simple integration through to sophisticated business protocols, all with detailed code examples that you can adapt for your own ends.
Should I Read This Book?
Like most of us, youre probably already building something that feeds into the Web, and youve probably used tools and patterns for the Web that seem pretty useful. Then youve tackled typical enterprise problems and wondered why it cant be as nice as the web stuff.
Youre seeing the benefits of the Web all around and you start to question whether your enterprises expensive middleware offers a good return on investment, or whether it will ever scale to meet your users demands.
You might be a developer who wants to understand the Webs principles in more detail, and likes to learn through code examples. Youve heard terms such as URIs, HTTP , and Atom , and you want to learn more about them, including the type of support you can get from popular programming platforms.
You may even be an enthusiast who has heard about REST and wants to know what it is all about. You want to learn more about hypermedia and the REST architectural style so that you can build resource-oriented systems and implement sophisticated business protocols atop the Web.
This book will help.
Should I Skip This Book?
If you are looking to learn how to design websites or how to write JavaScript applications, this book will not offer you much, though theres plenty for competent AJAX developers to leverage from our approach to building backend services.
If you are looking to build mashups or systems for people to use directly, this book is probably not for you. Weve focused on machine-to-machine interactions. In fact, this book is full of machines talking to one another through the Web.
We rather like it that way.
Resources
The book is accompanied by a website: http://restinpractice.com. There youll find working code samples from the book, links to other resources, errata, and community information. We will make every effort to continuously update the site with more information.
What Did You Think About the Book?
We are very interested in your thoughts on this book, positive or negative. You can head to Amazon and share your thoughts by writing a review. Alternatively, OReilly would be more than happy to hear your views at:
http://www.oreilly.com/catalog/9780596805821/
Errata
While we have made every effort to keep the book error-free, we have probably missed a few things. Errata give readers a way to let us know about typos, errors, and other problems with the book. You can head to the books URI at OReilly in order to let us know. Wed really appreciate it:
http://www.oreilly.com/catalog/9780596805821/
Alternatively, you can reach us directly. Our contact details can be found on the books website:
http://restinpractice.com
We will post corrections on both websites as soon as possible after confirming the identified issue. OReilly can also fix errata in future printings of the book and on Safari, so you can help make the book even better. Well credit your assistance on the website and in any future editions too!
Conventions Used in This Book
The following font conventions are used in this book:
ItalicIndicates Internet addresses, such as domain names and URIs, and new items where they are defined
Constant width
Indicates method, variable, and class names in programs; also, XML element and attribute names, and HTTP idioms
Constant width bold
Indicates emphasis in program code lines