RESTful web services and the associated Resource Oriented Architectures (ROA) have received plenty of attention lately. Even though REST and the underlying technologies are not exactly new, their usage to build distributed systems has gained in momentum only recently. Many corporations offer their services using RESTful web services, today. Examples are Amazon, eBay, Yahoo (including Flickr) and DropBox. REST will most likely play a central role in building the Internet of Things.
What is REST?
The term REST stands for Representational State Transfer and identifies an architectural style for building distributed systems. In essence, RESTful web services use existing, proven web standards – most prominently HTTP – and adhere to a number of principles for using these standards. Stefan Tilkov summarized these principles as follows:
- Give every thing (aka resource) an ID. Use URIs and make every thing addressable in a global namespace that way.
- Link things together. Use links to refer to identifiable things wherever possible. (It’s what makes the web the web). This principle is also known as HATEOAS – Hypermedia as the Engine of Application State.
- Use standard methods. HTTP has all you need for CRUD operations: GET, PUT, POST, DELETE and a couple of other methods with well defined semantics. This unifies RESTful interfaces – learn one, understand all.
- Things can have multiple representations. Provide the representations, such as e. g. XML, JSON or HTML that satisfy your needs.
- Communicate statelessly. The application state is only on the client; the server only knows the resource state. Scalability is the result.
REST and the Internet of Things
REST and the Internet of Things (and Services) can be an excellent match. REST implementations are lightweight – HTTP clients and servers are now available even on the smallest, IP-enabled platforms. It is therefore attractive for the embedded systems we build at Bosch.
The key abstraction of a RESTful web service is the resource, not a service (as seen in Service Oriented Architectures – SOA). In my experience, this abstraction fits very well in the Bosch world of embedded control systems. Sensors, actors and control systems in general can be elegantly represented as resources and their service exposed through a RESTful web service.
Experience at Bosch
I am involved in the development of several RESTful interfaces which are currently used within Bosch in my work for the FusionX Bosch Internal Open Source Community. As of now, we have built RESTful interfaces for Bosch heating systems and vehicles and have used these in both browser as well as mobile applications. The Bosch Thermo Technology Business unit has now added a gateway to their product portfolio which allows to remotely control their heating systems based on our RESTful interface. Other business units are currently adopting RESTful interfaces for remote access and control as well. All in all, RESTful interfaces are on their way up within Bosch.
I would like to encourage you to share your experience in implementing and using RESTful web services in this Blog. What have you learned and what role do you think they will play in the future of the internet of things and services?