rest presentation

35
Give it a REST already Arnon Rotem-Gal-Oz http://arnon.me

Upload: arnon-rotem-gal-oz

Post on 10-May-2015

2.017 views

Category:

Technology


0 download

DESCRIPTION

(update) introduction to REST

TRANSCRIPT

Page 1: REST presentation

Give it a REST already

Arnon Rotem-Gal-Ozhttp://arnon.me

Page 2: REST presentation

SomeTheory

Page 3: REST presentation

Making sense of the terminology soup

Code/Detailed Design

Design

Design Patterns Architecture

Architectural PatternsArchitectural Styles

Page 4: REST presentation

SOA vs. RESTPipes and

FiltersClient Server

Uniform Interface

Virtual Machine

DistributedAgents

LayeredSystem

Replicated Repository

Code OnDemand

StatelessComm. Cacheable

RESTSOA

Page 5: REST presentation

REST = "Representation State Transfer"

Data Management

(Resource)

Categorization App

Categorization(Resource)

Get(schema)

Schema Details (XML)

Post(Run Job)

Job Id +URL (JSON)

Page 6: REST presentation

Layers should have some constraints on communications

Layer?

Layer?

Layer?

Layer?

Page 7: REST presentation

Layer

Layers should have some constraints on communications

Component

Component

Layer

layer

Page 8: REST presentation

Layer

Layers should have some constraints on communications

Component

Component

Layer

Layer

Page 9: REST presentation

Client/Server

Client Server

Capabilities (services)Requests initiator

Request

Reply

Page 10: REST presentation

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

Page 11: REST presentation

The uniform interface

Page 12: REST presentation

Document Centric messages provide the client with the

needed stateand allow stateless

communications

Page 13: REST presentation

REST also externalize state transitions (HATEOAS)

Current Representation

E.g. Order

Link to product 1

Link to Product 2

Link to customer

Page 14: REST presentation

321root

/

Sessions/

Abcde/

Efgh/

Resources/ Dispatchers/ Xyz/

Example – Resource Manager

Page 15: REST presentation

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 16: REST presentation

Use IDs that are linkse.g. a

Page 17: REST presentation

HTTP is the most common REST implementation

Page 18: REST presentation

But you can create others

Waka canoe

Page 19: REST presentation

GET = query/read a resource for a representation

Page 20: REST presentation

PUT = create with ID set by the

client / replace

Page 21: REST presentation

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

Page 22: REST presentation

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

Page 23: REST presentation

HEAD = GET but only retrieves

metadata (headers)

Page 24: REST presentation

OPTIONS – The currently available

verbs / requirements for communication

Page 25: REST presentation

Why REST?

Page 26: REST presentation

(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)

/ /

Page 27: REST presentation

Technology Mapping

Page 28: REST presentation

Jax-RS

Page 29: REST presentation

Spring HATEOAS

Page 30: REST presentation

Common REST misconceptions

Page 31: REST presentation

REST = CRUD

Page 32: REST presentation

REST is the ultimate architecture

Page 33: REST presentation

REST = HTTP

Page 34: REST presentation

REST will automagically make you write perfect distributed systems

Page 35: REST presentation

REST is Simpler