Series: Caelum Day 2009 | Part 3 of 7 > Comprehensive coverage of cutting-edge talks from Rio’s premier Java event
Continuing the Caelum Day in Rio series, today I want to share my impressions from Sergio Junior and Luiz Costa’s talk on RESTful APIs.
Demystifying REST
Before this talk, I had only a vague understanding of REST. They made it clear that REST is not just about using HTTP verbs like GET and POST, but about an architecture that emphasizes well-defined resources, proper use of HTTP methods, and most importantly, hypermedia as the engine of application state (HATEOAS).
Introduction to Restfulie
They introduced Restfulie, a library developed by Caelum to make it easier to build RESTful APIs in Java. What stood out to me was how Restfulie:
- Simplifies object serialization to XML or JSON
- Adds navigational links to responses so the client can discover the next available actions
- Integrates smoothly with VRaptor, which I had just seen in the previous session
For example, when returning an order, the API might include links to “pay” or “cancel” that guide the client through available transitions.
Practical Example
They showed an example where a “Pedido” (Order) resource includes links to related actions:
<pedido>
<produto>Curso de Java</produto>
<link rel="payment" href="http://example.com/pedidos/1/pay"/>
<link rel="cancel" href="http://example.com/pedidos/1/cancel"/>
</pedido>
On the client side, you could follow these links to trigger corresponding actions, without needing to know the URLs beforehand.
Explore Restfulie
Restfulie is open source and you can explore the hypermedia library on GitHub: Restfulie on GitHub
Final Thoughts
The talk really opened my eyes to the idea that building RESTful APIs is not just about mapping URLs to methods. It’s about designing an interface that guides the client through possible states, making the application more intuitive and flexible.
I left the room inspired to study REST further and to try out Restfulie in future projects.
Next in the series: Nico Steppat’s talk on NoSQL. See you soon!
Series Navigation
- Introduction: Caelum Day Overview
- Previous: Part 2 - VRaptor 3 Framework
- Current: Part 3 - RESTful APIs
- Next: Part 4 - NoSQL Databases
- Complete series: Cloud Computing | VRaptor 3 | NoSQL | Flex | Java Persistence | Technical Leadership