Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
R.I.P.: REST in peace! A guide through RESTful ...
Search
Robson de Almeida
December 05, 2014
Technology
2
130
R.I.P.: REST in peace! A guide through RESTful services.
I did this presentation in the #9 Superplayer Hack Sessions.
Robson de Almeida
December 05, 2014
Tweet
Share
More Decks by Robson de Almeida
See All by Robson de Almeida
The Road to Node(JS)
robsondealmeida
0
64
The MongoDB Quest - a tale of shards replicas and a lot of data
robsondealmeida
0
85
The Queue is dead! Long live the Event!
robsondealmeida
1
190
Startup for Developers: each line matters.
robsondealmeida
0
87
The Lean Startup na Prática
robsondealmeida
0
200
Other Decks in Technology
See All in Technology
JavaScript 研修
recruitengineers
PRO
2
130
実践アプリケーション設計 ①データモデルとドメインモデル
recruitengineers
PRO
2
200
AIエージェントの開発に必須な「コンテキスト・エンジニアリング」とは何か──プロンプト・エンジニアリングとの違いを手がかりに考える
masayamoriofficial
0
360
Go で言うところのアレは TypeScript で言うとコレ / Kyoto.なんか #7
susisu
5
1.4k
夢の印税生活 / Life on Royalties
tmtms
0
280
Goでマークダウンの独自記法を実装する
lag129
0
210
知られざるprops命名の慣習 アクション編
uhyo
10
2.4k
kintone開発チームの紹介
cybozuinsideout
PRO
0
73k
イオン店舗一覧ページのパフォーマンスチューニング事例 / Performance tuning example for AEON store list page
aeonpeople
2
260
JOAI発表資料 @ 関東kaggler会
joai_committee
1
260
アジャイルテストで高品質のスプリントレビューを
takesection
0
110
OpenAPIから画面生成に挑戦した話
koinunopochi
0
150
Featured
See All Featured
Designing for Performance
lara
610
69k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
110
20k
Facilitating Awesome Meetings
lara
55
6.5k
KATA
mclloyd
32
14k
What's in a price? How to price your products and services
michaelherold
246
12k
Scaling GitHub
holman
462
140k
Building an army of robots
kneath
306
46k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
50k
Visualization
eitanlees
147
16k
Documentation Writing (for coders)
carmenintech
73
5k
Making the Leap to Tech Lead
cromwellryan
134
9.5k
Practical Orchestrator
shlominoach
190
11k
Transcript
R.I.P.: REST IN PEACE! a guide through RESTful services
WHY REST ?
WHY REST ? well known concepts optimised technologies and infrastructure
lightweight approach better scale
WHAT REST DO NOT MEANS
WHAT REST DO NOT MEANS REST is NOT a framework
REST is NOT a protocol REST is NOT SOA REST is NOT Client-Server Architecture REST is NOT a URI REST is NOT API
WHAT REST MEANS ?
REST IS ABOUT STYLE
the REST creator
Roy Fielding== Roy Rosello
ROY's WORK … Architectural Styles and the Design of Network-based
Software Architectures REpresentational State Transfer is a architectural style for distributed hypermedia systems HTTP spec & Apache HTTP server
REST CONSTRAINTS
REST CONSTRAINTS CLIENT-SERVER STATELESS RESOURCES
STATELESS each request contains all of the information and cannot
take advantage of any stored context on the server session state is kept entirely on the client
RESOURCES the key abstraction of information in REST is a
resource a resource IS NOT an API or ENDPOINT or METHOD
RESOURCE IDENTIFIER Uniform Resource Identifier (URI) the key to access
the resource { protocol } : { base uri } / { resource path }
URI IS NOT an URL or URN but it covers
it uniform resource locator uniform resource name
REST APIs BEST AND WORSE PRACTICES
NOUNS, NO VERBS
NOUNS, NO VERBS Leave verbs for the HTTP verbs /playlists
/playlists/10 /getAllPlaylists /getPlaylist?id=10 /get?type=playlist&id=10 good bad
HTTP VERBS TO MEAN SOMETHING
GET /playlists GET /playlists/10 POST /playlists PUT /playlists/10 DELETE /playlists/10
HTTP VERBS TO MEAN SOMETHING
HTTP GET SHOULD NOT ALTER THE STATE
use POST, PUT and DELETE. also do not use GET
when you HAVE no choice GET /subscriptions/171/cancel // bad PUT /subscriptions/171/cancel // bad but better ... HTTP GET SHOULD NOT ALTER THE STATE
HTTP STATUS CODE
for successful requests, use 2xx status code. when the client
is wrong, use 4xx status code. for unknown errors, use 5xx status code HTTP STATUS CODE
HTTP HEADERS FOR SERIALIZATION FORMATS
Accept: application/json prefer JSON. HTTP HEADERS FOR SERIALIZATION FORMATS
VERSIONING
prefer /v1, /v2 Instead of /1.0 /v1.0 /20141201 the version
is part of the base URI VERSIONING
ERROR HANDLING
use a standard structure for error messages always identify the
error with a key/code. ERROR HANDLING
THE ZOMBIES FAMILY
THANKS speakerdeck.com/robsondealmeida /robsondealmeida /robsondealmeida