5. Resource & Representation
Resource = the real thing
Representation = server responses
"A request interacts with a resource and
receives a representation."
6. REST Verbs
Match HTTP semantics:
● GET : read resources, safe, cache friendly
● POST : update resources, create
● PUT : replace entire resource, atomic
● DELETE : delete entire resource, atomic
● HEAD
● PATCH
7. REST Batch Operations
A request can act on a single resource or a
class of resources.
E.g.
POST /todos/1 {'email', 'new@example.com'}
POST /todos?email=x {'email': 'other@x.com'}
11. Architectures #3
Web UI Database
Internal
API Platform Queues
APIs
Mobile Other
12. Dropwizard
Thanks Yammer (Coda Hale) for making it
open source!
Framework for JVM-based backend services
"Dropwizard has out-of-the-box support for sophisticated configuration,
application metrics, logging, operational tools, and much more, allowing you
and your team to ship a production-quality HTTP+JSON web service in the
shortest time possible."
13. Components
● Jetty for HTTP
● Jersey for REST
● Jackson for JSON
● Metrics for metrics
● And: guava, logback, hibernate validator,
jersey client libraries, jdbi, freemarker
http://dropwizard.codahale.com/getting-started/
15. Specification
"A simple todo list sample application implemented using
Dropwizard as the core framework with a simple UI that
consumes the REST API based on twitter bootstrap,
backbone.js, jquery and jasmine."
https://github.com/bucharest-jug/dropwizard-todo
16. REST Endpoints
GET /todos | GET /todos/{id}
POST /todos
PUT /todos/{id}
DELETE /todos | DELETE /todos/{id}
17. Resources: Todo List
● id : assigned by server on creation (Read
Only)
● created : assigned on creation
● email: owner email address
● items: list of items
18. Resources: Todo Item
● title: a text description of what need to be
done
● created: date time assigned on creation
● finished: date time assigned when the item
was finished
23. Deployment: Continuous
High quality test suite (unit + live + smoke)
Continuous Deployment Pipeline
All new code is deployed to multiple
environments and production.
OpenAgile Timisoara anyone?
24. Resources
● Demo code:
https://github.com/bucharest-jug/dropwizard-todo
● All about Dropwizard:
http://dropwizard.codahale.com/
● API Grove: API management:
http://apigrove.net/