rest presentation
DESCRIPTION
(update) introduction to RESTTRANSCRIPT
Give it a REST already
Arnon Rotem-Gal-Ozhttp://arnon.me
SomeTheory
Making sense of the terminology soup
Code/Detailed Design
Design
Design Patterns Architecture
Architectural PatternsArchitectural Styles
SOA vs. RESTPipes and
FiltersClient Server
Uniform Interface
Virtual Machine
DistributedAgents
LayeredSystem
Replicated Repository
Code OnDemand
StatelessComm. Cacheable
RESTSOA
REST = "Representation State Transfer"
Data Management
(Resource)
Categorization App
Categorization(Resource)
Get(schema)
Schema Details (XML)
Post(Run Job)
Job Id +URL (JSON)
Layers should have some constraints on communications
Layer?
Layer?
Layer?
Layer?
Layer
Layers should have some constraints on communications
Component
Component
Layer
layer
Layer
Layers should have some constraints on communications
Component
Component
Layer
Layer
Client/Server
Client Server
Capabilities (services)Requests initiator
Request
Reply
Replicated Repository is about having more than one copy providing the
same service
looks like one copybetter performance and latency
copy
copy
copy
copy
copy
copy
copy
copy
copy
The uniform interface
Document Centric messages provide the client with the
needed stateand allow stateless
communications
REST also externalize state transitions (HATEOAS)
Current Representation
E.g. Order
Link to product 1
Link to Product 2
Link to customer
321root
/
Sessions/
Abcde/
Efgh/
Resources/ Dispatchers/ Xyz/
Example – Resource Manager
http://devrig:52141/RM/Sessions/abc/
• ATOMPUB– Session details
• URI (ID)• State (start/end/status etc.)• Resources
– Knows status– URI for the Resource representation on the RM– URI for the Resource itself
Use IDs that are linkse.g. a
HTTP is the most common REST implementation
But you can create others
Waka canoe
GET = query/read a resource for a representation
PUT = create with ID set by the
client / replace
POST = Create a subordinate resource with ID set by server / update
DELETE= remove the URI (most likely delete the resource)
HEAD = GET but only retrieves
metadata (headers)
OPTIONS – The currently available
verbs / requirements for communication
Why REST?
(original) Categories REST API
Categories
Tasks
<Cat Id>
Interactions
<Task Id>
POST – create new categoryGET – List categories / search for category
POST – run discovery GET – list running categoriezations
GET– check progress/status of running categorization DELETE– abort categorization
GET– Get Category definitionPUT– update category (state or definition)DELETE – remove category
GET – search interactionsPOST – Create interactions (bulk)
<Int Id>
<Seg Id>
GET– Retrieve InteractionsPUT– Create /Update Interaction
GET– Retrieve segmentPUT– Create /Update segment (e.g. words from audio-analysis)
/ /
Technology Mapping
Jax-RS
Spring HATEOAS
Common REST misconceptions
REST = CRUD
REST is the ultimate architecture
REST = HTTP
REST will automagically make you write perfect distributed systems
REST is Simpler