Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
REST my dongle #kreait-dev-days
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Armen Mkrtchyan
June 05, 2015
Programming
140
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
REST my dongle #kreait-dev-days
REST best practices, HAL, HATEOAS
Armen Mkrtchyan
June 05, 2015
More Decks by Armen Mkrtchyan
See All by Armen Mkrtchyan
Api Protection
iamtankist
2
480
Life on the edge between AngularJS and Symfony2
iamtankist
9
3.8k
Other Decks in Programming
See All in Programming
Simple Storage Service(S3) is not simple
iwatsukayura
0
230
Findy - エンジニア向け会社紹介/Findy Company Deck
findyinc
6
400k
RAG の “R” を Swift で覗いてみる 〜「意味から探す」検索の仕組み〜
nao_randd
0
120
AWSに止められる覚悟してますか?
morizo_1984
2
520
動作中のプログラムの中身をリアルタイムに覗く / Realtime Debugger for CSharp with Roslyn
prota
1
1.8k
月間100万人のサービス刷新で、 技術選定をHonoに振り切った話
yutobara
8
5.8k
Are APIs Still Relevant in the AI Era?
soyuka
0
440
Everything will be SERVERLESS — 信じて運用した10年の経験値 / Everything Will be Serverless — Lessons Learned from 10 Years of Operational Experience
seike460
PRO
1
890
気持ちぃ〜角丸 Squircle
ryu1013
0
150
Embedded Swiftで作る自作USBデバイス によるiOSデバイスの自動テスト / iOSDC Japan 2026 glassfiber
glassfiber
0
310
AI主導のプログラミング学習アプリを作ってみた
econanringo
0
120
Domain-Driven Transformation
hschwentner
2
2.3k
Featured
See All Featured
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
440
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.6k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
210
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
203
77k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2.2k
WCS-LA-2024
lcolladotor
0
860
Odyssey Design
rkendrick25
PRO
2
860
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
20k
Bash Introduction
62gerente
615
220k
AI: The stuff that nobody shows you
jnunemaker
PRO
10
1.1k
Transcript
Logitech R400
Slide 1
Slide 2
GET /slides
[ { "id": 1, "content": "Slide 1" }, { "id":
2, "content": "Slide 2" }, ]
GET /slide/1
{ "id": 1, "content": "Slide 1", "background": "white", "text": "#031337"
}
Verb Method GET /slides Get list of slides C POST
/slides Create new slide R GET /slides/:id Get specific slide U PUT /slides/:id Update slide D DELETE /slides/:id Delete slide
Next Previous
None
1. GET /slides 2. Remember IDs 3. Figure out index
4. index++ 5. GET /slides/2
GET /slides/1/next GET /nextSlide/1
REST Maturity Model
HATEOAS (Hypertext As The Engine Of Application State) Level 3:
Hypermedia HAL (Hypertext Application Language)
{ "id": 5, "content": "Slide 1", "background": "white", "text": "#031337"
"_links": { "self": { "href": "/slides/5" }, "prev": { "href": "/slides/4" }, "next": { "href": "/slides/6" }, "first": { "href": "/slides/1" }, "last": { "href": "/slides/12" } } }
HAL + JSON http://stateless.co/hal_specification.html
R(B)EST practices
1. Do not use verbs /getAllSlides /createNewSlide /deleteAllBlackSlides GET /slides
POST /slides DELETE /slides?filter=black
2. GET method should NEVER alter the state GET /slide/1?action=disable
POST /slides/1/disable or PUT /slides/1/disable
3. Use plural nouns /slide /slides
4. Use sub-resources for relations GET /animationsForSlide/1 DELETE /animationsFromSlide/1/2 GET
/slides/1/animations/ DELETE /slides/1/animations/3
5. Use HTTP headers for serialization formats Content-type: application/vnd+com.kreait.slide+json
6. Use HAL { "id": 1, "content": "Slide 1", "background":
"white", "text": "#031337" "_links": { "self": { "href": "/slides/1" }, "next": { "href": "/slides/2" } } }
7. Filtering, Sorting, field selection and paging Filter GET /slides?background=white
Sort GET /slides?sort=-title,+length Limit Fields GET /slides?fields=id,title Pagination GET /slides?offset=10&limit=5
8. Version your API In URL: /api/v1/slides
9. Handle Errors with HTTP status codes http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html and https://github.com/joho/7XX-rfc
Errors in vnd.error format (https://github.com/blongden/vnd.error) or at least something consistent
10. Allow overriding HTTP method X-HTTP-Method-Override: PUT
Dongle included Thanks!