Rest

31
Give it a REST already Arnon Rotem-Gal-Oz VP R&D xsights www.xsights.com www.rgoarchitects.com/nblog

Transcript of Rest

Page 1: Rest

Give it a REST already

Arnon Rotem-Gal-OzVP R&D xsights

www.xsights.comwww.rgoarchitects.com/nblog

Page 2: Rest

SomeTheory

Page 3: Rest

Making sense of the terminology soup

Code/Detailed Design

Design

Design Patterns Architecture

Architectural PatternsArchitectural Styles

Page 4: Rest

SOA vs. RESTPipes and

FiltersClient Server

Uniform Interface

Virtual Machine

DistributedAgents

LayeredSystem

Replicated Repository

Code OnDemand

StatelessComm. Cacheable

RESTSOA

Page 5: Rest

REST = "Representation State Transfer"

Dispatcher

WebApp

Cache(Resource)

Put (New State in XML)

OK

Get (Latest State)

Representation(JSON)

Page 6: Rest

Layers should have some constraints on communications

Layer?

Layer?

Layer?

Layer?

Page 7: Rest

Layer

Layers should have some constraints on communications

Component

Component

Layer

Componet

Page 8: Rest

Client/Server

Client Server

Capabilities (services)Requests initiator

Request

Reply

Page 9: Rest

Replicated Repository is about having

more than one copy providing

the same service looks like one copy

better performance and latency

copy

copy

copy

copy

copy

copy

copy

copy

copy

Page 10: Rest

The uniform interface

Page 11: Rest

Document Centric messages provide

the client with the needed state

and allow stateless

communications

Page 12: Rest

REST also externalize state transitions

Page 13: Rest

Use IDs that are linkse.g. a

Page 14: Rest

Technology Mapping

Page 15: Rest

HTTP is the most common REST implementation

Page 16: Rest

But you can create others

Waka canoe

Page 17: Rest

GET = query/read a resource for a representation

Page 18: Rest

PUT = create with ID set by the

client / replace

Page 19: Rest

POST = Create a subordinate resource with ID set by server / update

Page 20: Rest

DELETE= remove the URI (most likely delete the resource)

Page 21: Rest

HEAD = GET but only retrieves

metadata (headers)

Page 22: Rest

OPTIONS – The currently available

verbs / requirements for communication

Page 23: Rest

Why REST?

Page 24: Rest

Example – Resource Manager

Page 25: Rest

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

Page 26: Rest

Common REST misconceptions

Page 27: Rest

REST = CRUD

Page 28: Rest

REST is the ultimate architecture

Page 29: Rest

REST = HTTP

Page 30: Rest

REST will automagically make you write perfect distributed systems

Page 31: Rest

REST is Simpler