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
REST my dongle #kreait-dev-days
Search
Armen Mkrtchyan
June 05, 2015
Programming
130
1
Share
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
470
Life on the edge between AngularJS and Symfony2
iamtankist
9
3.7k
Other Decks in Programming
See All in Programming
AgentCore Optimizationを始めよう!
licux
3
240
AlarmKitで明後日起きれるアラームアプリを作る
trickart
0
140
My daily life on Ruby
a_matsuda
3
390
cloudnative conference 2026 flyle
azihsoyn
0
180
Surviving Black Friday: 329 billion requests with Falcon!
ioquatix
0
3.1k
PHPer、Cloudflare に引っ越す
suguruooki
2
220
検索設計から 推論設計への重心移動と Recall-First Retrieval
po3rin
5
1.7k
Programming with a DJ Controller — not vibe coding
m_seki
3
860
サプライチェーン攻撃対策「層を重ねて落ちない壁」を10日間で組み上げた話 #TechLeadConf2026
kashewnuts
1
290
「なんか〇〇ライブラリで脆弱性あるみたいなんだけど。。。」から始める脆弱性対応 / First Steps in Vulnerability Response
mackey0225
2
130
SREに優しいTerraform構成 modulesとstateの組み方
hiyanger
2
180
【ディップ|26年新卒研修資料】TDD実装演習
dip_tech
PRO
0
190
Featured
See All Featured
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
210
Documentation Writing (for coders)
carmenintech
77
5.3k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
300
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.7k
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
My Coaching Mixtape
mlcsv
0
130
Utilizing Notion as your number one productivity tool
mfonobong
4
300
Building an army of robots
kneath
306
46k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.1k
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
560
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
690
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
140
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!